pub struct WeightComponentSegment<'source> { /* private fields */ }Expand description
One ordered byte segment of a physical weight component.
A segment may borrow directly from immutable checkpoint storage. When a
backend needs to retain that storage beyond the source request, the
attached RetainedHostMemoryRegion proves and owns the exact borrowed
range.
Implementations§
Source§impl<'source> WeightComponentSegment<'source>
impl<'source> WeightComponentSegment<'source>
pub fn new(bytes: impl Into<Cow<'source, [u8]>>) -> Self
Sourcepub fn with_retained_host_memory(
self,
retained_host_memory: RetainedHostMemoryRegion,
) -> Result<Self, VNextError>
pub fn with_retained_host_memory( self, retained_host_memory: RetainedHostMemoryRegion, ) -> Result<Self, VNextError>
Attach the stable owner for this segment. Pointer and length identity are checked so a backend cannot retain a different mmap range than the segment validated against the component schema.
pub fn bytes(&self) -> &[u8] ⓘ
pub fn retained_host_memory(&self) -> Option<&RetainedHostMemoryRegion>
Auto Trait Implementations§
impl<'source> !RefUnwindSafe for WeightComponentSegment<'source>
impl<'source> !UnwindSafe for WeightComponentSegment<'source>
impl<'source> Freeze for WeightComponentSegment<'source>
impl<'source> Send for WeightComponentSegment<'source>
impl<'source> Sync for WeightComponentSegment<'source>
impl<'source> Unpin for WeightComponentSegment<'source>
impl<'source> UnsafeUnpin for WeightComponentSegment<'source>
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