pub struct ExternalStorage { /* private fields */ }Expand description
Full re-export of zenpixels core types (zero module name collisions!).
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.