pub unsafe trait StorageExt: Send + Sync {
// Required method
fn create(self) -> (*const u8, usize, &'static StorageVTable);
}Expand description
Types that can be used as external storage for Bytes, see
Bytes::from_ext.
§Safety
Bytes trusts the values returned by create without checking them:
- For the returned
(addr, len)pair, and for every pair returned by the vtable’sclone,as_ptrandlenmust describe memory that is readable forlenbytes and stays valid and unchanged untildropis called for that pair. - The vtable functions can be called from any thread.
Bytes calls drop exactly once for each pair and does not use the pair
afterwards.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".