Skip to main content

StorageExt

Trait StorageExt 

Source
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’s clone, as_ptr and len must describe memory that is readable for len bytes and stays valid and unchanged until drop is 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§

Source

fn create(self) -> (*const u8, usize, &'static StorageVTable)

Converts the value into an (addr, len) pair and the vtable that operates on it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StorageExt for Arc<str>

Source§

fn create(self) -> (*const u8, usize, &'static StorageVTable)

Implementors§