pub trait FromMemoryBackend: Sized {
// Required methods
fn from_memory_backend(
memory: MemoryBackend,
) -> impl Future<Output = Result<Self>> + Send;
fn initialize_memory_backend(
memory: MemoryBackend,
) -> impl Future<Output = Result<Self>> + Send;
fn close_memory(self) -> MemoryBackend;
}Expand description
A trait for types that can be constructed from a memory device.
This trait provides an asynchronous interface for creating instances of types
from a MemoryDevice. Implementors should define how to read and parse data
from the memory device to construct their specific type.
§Errors
Implementations should return an error if:
- The memory device cannot be accessed
- The data format is invalid or corrupted
- Required data is missing from the memory device
Required Methods§
Sourcefn from_memory_backend(
memory: MemoryBackend,
) -> impl Future<Output = Result<Self>> + Send
fn from_memory_backend( memory: MemoryBackend, ) -> impl Future<Output = Result<Self>> + Send
Sourcefn initialize_memory_backend(
memory: MemoryBackend,
) -> impl Future<Output = Result<Self>> + Send
fn initialize_memory_backend( memory: MemoryBackend, ) -> impl Future<Output = Result<Self>> + Send
Get a specific memory by its ID and initialize it according to the defaults. Note that the values will not be written to the memory by default, the user needs to handle this.
§Arguments
memory- The MemoryDevice struct representing the memory to get
§Returns
An Option containing a reference to the MemoryDevice struct if found, or None if not found
Sourcefn close_memory(self) -> MemoryBackend
fn close_memory(self) -> MemoryBackend
Close the memory and return the backend to the subsystem
§Arguments
memory_device- The MemoryDevice struct representing the memory to closebackend- The MemoryBackend to return to the subsystem
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.