pub unsafe trait WriteToMemory {
// Required method
fn write_to_memory(address: usize, value: Self)
where Self: Sized;
}Expand description
This trait provides an ability to write a value of type Self into memory
at the given address.
§Examples
To use it simply call it with :
fn main() {
// This write a u16 of value 10 in the 0x1000 internal memory address
ReadFromMemory::write(0x1000, 10u16);
}Required Methods§
Sourcefn write_to_memory(address: usize, value: Self)where
Self: Sized,
fn write_to_memory(address: usize, value: Self)where
Self: Sized,
Writes the value into memory at the specified address.
§Arguments
address- The destination address in memory to write to.value- The value to write to memory.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl WriteToMemory for &[f32]
impl WriteToMemory for &[f32]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[f64]
impl WriteToMemory for &[f64]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[i8]
impl WriteToMemory for &[i8]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[i16]
impl WriteToMemory for &[i16]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[i32]
impl WriteToMemory for &[i32]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[i64]
impl WriteToMemory for &[i64]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[u8]
impl WriteToMemory for &[u8]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[u16]
impl WriteToMemory for &[u16]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[u32]
impl WriteToMemory for &[u32]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for &[u64]
impl WriteToMemory for &[u64]
fn write_to_memory(address: usize, value: Self)
Source§impl WriteToMemory for String
Caution: This code assumes the use of ASCII characters only. ⚠️
impl WriteToMemory for String
Caution: This code assumes the use of ASCII characters only. ⚠️
To handle strings with a different character encoding, first convert the string to a byte array using the WriteToMemory::<&u8>() method, and then convert it to your desired string format.