pub struct ExternalStorage { /* private fields */ }Expand description
Type-erased immutable external owned backing storage (Arc<[T]>, &'static [T],
memory-mapped files, shared buffer pools, FFI read-only buffers).
Read access is strictly zero-copy. Requesting mutable access through PixelStorage
or PixelBuf performs copy-on-write promotion into 64-byte aligned
owned storage; calling into_inner recovers the original
owner S zero-copy without touching its backing allocation.
Implementations§
Source§impl ExternalStorage
impl ExternalStorage
Sourcepub fn new<S>(owner: S) -> ExternalStorage
pub fn new<S>(owner: S) -> ExternalStorage
Wrap any S: ByteStorage + Send + Sync + 'static zero-copy.
Sourcepub fn truncate(&mut self, byte_len: usize)
pub fn truncate(&mut self, byte_len: usize)
Narrow active byte length without touching or copying the external owner.
Sourcepub fn downcast_ref<S>(&self) -> Option<&S>where
S: 'static,
pub fn downcast_ref<S>(&self) -> Option<&S>where
S: 'static,
Borrow the original external owner if its concrete type is S.
Sourcepub fn into_inner<S>(self) -> Result<S, ExternalStorage>where
S: 'static,
pub fn into_inner<S>(self) -> Result<S, ExternalStorage>where
S: 'static,
Recover the original external owner S zero-copy; returns Err(self) untouched if
the stored type is not S.
Trait Implementations§
Source§impl ByteStorage for ExternalStorage
impl ByteStorage for ExternalStorage
Auto Trait Implementations§
impl !RefUnwindSafe for ExternalStorage
impl !UnwindSafe for ExternalStorage
impl Freeze for ExternalStorage
impl Send for ExternalStorage
impl Sync for ExternalStorage
impl Unpin for ExternalStorage
impl UnsafeUnpin for ExternalStorage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more