SD
Size: a a a
SD
p
pub trait Memory<T> {
fn new(size: usize, max_size: usize, endianness: Endianness) -> Self;
fn read_byte(&self, addr: usize) -> u8;
fn write_byte(&mut self, addr: usize, val: u8);
fn read_word<T>(&self, addr: usize) -> Result<T, Error>;
fn write_word<T>(&mut self, addr: usize, val: T) -> Result<(), Error>;
}
impl Memory<u16> for Mem {
fn read_word(&self, addr: usize) -> Result<u16, Error>;
…
impl Memory<u32> for Mem {
fn read_word(&self, addr: usize) -> Result<u32, Error>;
ΑZ
YM
ΑZ
ΑZ
K
ΑZ
M
ΑZ
pub trait Memory<T> {
fn new(size: usize, max_size: usize, endianness: Endianness) -> Self;
fn read_byte(&self, addr: usize) -> u8;
fn write_byte(&mut self, addr: usize, val: u8);
fn read_word(&self, addr: usize) -> Result<T, Error>;
fn write_word(&mut self, addr: usize, val: T) -> Result<(), Error>;
}
M
r
А
M
M
impl Point<f32> {
fn distance_from_origin(&self) -> f32 {
(self.x.powi(2) + self.y.powi(2)).sqrt()
}
}
c
impl Point<f32> {
fn distance_from_origin(&self) -> f32 {
(self.x.powi(2) + self.y.powi(2)).sqrt()
}
}
M
c
ΑZ
impl Point for MyType
M
Impl Point for MyType<u16>
мне так надо