pub unsafe trait Ipc {
type Original;
Show 14 methods
// Required methods
fn from_slice<'a>(data: &'a [u8], signature: usize) -> Option<&'a Self>;
unsafe fn from_buffer_unchecked<'a>(data: &'a [u8]) -> &'a Self;
fn from_slice_mut<'a>(
data: &'a mut [u8],
signature: usize,
) -> Option<&'a mut Self>;
unsafe fn from_buffer_mut_unchecked<'a>(data: &'a mut [u8]) -> &'a mut Self;
fn as_original(&self) -> &Self::Original;
fn as_original_mut(&mut self) -> &mut Self::Original;
fn into_original(self) -> Self::Original;
fn lend(&self, connection: CID, opcode: usize) -> Result<(), Error>;
fn try_lend(&self, connection: CID, opcode: usize) -> Result<(), Error>;
fn lend_mut(&mut self, connection: CID, opcode: usize) -> Result<(), Error>;
fn try_lend_mut(
&mut self,
connection: CID,
opcode: usize,
) -> Result<(), Error>;
fn signature(&self) -> usize;
fn from_memory_message<'a>(msg: &'a MemoryMessage) -> Option<&'a Self>;
fn from_memory_message_mut<'a>(
msg: &'a mut MemoryMessage,
) -> Option<&'a mut Self>;
}Expand description
An object that can be sent across an IPC boundary, and can be reconstituted on the other side without copying. An object with this trait must be page-aligned, must be a multiple of the page size in length, and must not contain any pointers.
Required Associated Types§
Required Methods§
Sourcefn from_slice<'a>(data: &'a [u8], signature: usize) -> Option<&'a Self>
fn from_slice<'a>(data: &'a [u8], signature: usize) -> Option<&'a Self>
Create an Ipc variant from the original object. Succeeds only if
the signature passed in matches the signature of Original.
Sourceunsafe fn from_buffer_unchecked<'a>(data: &'a [u8]) -> &'a Self
unsafe fn from_buffer_unchecked<'a>(data: &'a [u8]) -> &'a Self
Unconditionally create a new memory message from the original object.
It is up to the caller to that data contains a valid representation of Self.
Sourcefn from_slice_mut<'a>(
data: &'a mut [u8],
signature: usize,
) -> Option<&'a mut Self>
fn from_slice_mut<'a>( data: &'a mut [u8], signature: usize, ) -> Option<&'a mut Self>
Create a mutable IPC variant from the original object. Succeeds only if
the signature passed in matches the signature of Original.
Sourceunsafe fn from_buffer_mut_unchecked<'a>(data: &'a mut [u8]) -> &'a mut Self
unsafe fn from_buffer_mut_unchecked<'a>(data: &'a mut [u8]) -> &'a mut Self
Unconditionally create a new mutable memory message from the original object.
It is up to the caller to that data contains a valid representation of Self.
Sourcefn as_original(&self) -> &Self::Original
fn as_original(&self) -> &Self::Original
Return a reference to the original object while keeping the memory version alive.
Sourcefn as_original_mut(&mut self) -> &mut Self::Original
fn as_original_mut(&mut self) -> &mut Self::Original
Return a reference to the original object while keeping the memory version alive.
Sourcefn into_original(self) -> Self::Original
fn into_original(self) -> Self::Original
Consume the memory version and return the original object.
Sourcefn lend(&self, connection: CID, opcode: usize) -> Result<(), Error>
fn lend(&self, connection: CID, opcode: usize) -> Result<(), Error>
Lend the buffer to the specified server. The connection should already be open and the server should be ready to receive the buffer.
Sourcefn try_lend(&self, connection: CID, opcode: usize) -> Result<(), Error>
fn try_lend(&self, connection: CID, opcode: usize) -> Result<(), Error>
Try to lend the buffer to the specified server, returning an error if the lend failed.
Sourcefn lend_mut(&mut self, connection: CID, opcode: usize) -> Result<(), Error>
fn lend_mut(&mut self, connection: CID, opcode: usize) -> Result<(), Error>
Lend the buffer to the specified server, and allow the server to modify the buffer.
Sourcefn try_lend_mut(&mut self, connection: CID, opcode: usize) -> Result<(), Error>
fn try_lend_mut(&mut self, connection: CID, opcode: usize) -> Result<(), Error>
Lend the buffer to the specified server, and allow the server to modify the buffer. Return an error if the lend failed.
Sourcefn signature(&self) -> usize
fn signature(&self) -> usize
Return the signature of this memory message. Useful for verifying that the correct message is being received.
Sourcefn from_memory_message<'a>(msg: &'a MemoryMessage) -> Option<&'a Self>
fn from_memory_message<'a>(msg: &'a MemoryMessage) -> Option<&'a Self>
Build an Ipc object from a xous::MemoryMessage. Verifies the signature and
returns None if there is no match.
Sourcefn from_memory_message_mut<'a>(
msg: &'a mut MemoryMessage,
) -> Option<&'a mut Self>
fn from_memory_message_mut<'a>( msg: &'a mut MemoryMessage, ) -> Option<&'a mut Self>
Build a mutable Ipc object from a mutable xous::MemoryMessage. Verifies the
signature and returns None if there is no match. The returned object has a
lifetime that’s tied to the MemoryMessage.
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.