pub unsafe trait Content {
type Owned;
// Required methods
unsafe fn read<F, E>(size: usize, _: F) -> Result<Self::Owned, E>
where F: FnOnce(&mut Self) -> Result<(), E>;
fn get_elements_size() -> usize;
fn to_void_ptr(&self) -> *const ();
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut Self>;
fn is_size_suitable(_: usize) -> bool;
}
Expand description
Trait for types of data that can be put inside buffers.
Required Associated Types§
Required Methods§
sourceunsafe fn read<F, E>(size: usize, _: F) -> Result<Self::Owned, E>
unsafe fn read<F, E>(size: usize, _: F) -> Result<Self::Owned, E>
Prepares an output buffer, then turns this buffer into an Owned
.
User-provided closure F
must only write to and not read from &mut Self
.
sourcefn get_elements_size() -> usize
fn get_elements_size() -> usize
Returns the size of each element.
sourcefn to_void_ptr(&self) -> *const ()
fn to_void_ptr(&self) -> *const ()
Produces a pointer to the data.
sourcefn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut Self>
fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut Self>
Builds a pointer to this type from a raw pointer.
sourcefn is_size_suitable(_: usize) -> bool
fn is_size_suitable(_: usize) -> bool
Returns true if the size is suitable to store a type like this.
Object Safety§
This trait is not object safe.