pub struct PinnedMemoryAllocController { /* private fields */ }Expand description
Hands out a pinned allocation as Bytes,
keeping the allocation alive for as long as the bytes are.
The binding is held and never read: dropping it is what returns the pages to the pool, so a caller that still has the slice still has the memory.
Implementations§
Source§impl PinnedMemoryAllocController
impl PinnedMemoryAllocController
Sourcepub fn init(
binding: ManagedMemoryBinding,
resource: PinnedMemoryResource,
) -> Self
pub fn init( binding: ManagedMemoryBinding, resource: PinnedMemoryResource, ) -> Self
A controller over the pinned allocation binding names, resolved to
resource.
Trait Implementations§
Source§impl AllocationController for PinnedMemoryAllocController
impl AllocationController for PinnedMemoryAllocController
Source§fn alloc_align(&self) -> usize
fn alloc_align(&self) -> usize
The alignment this allocation was created with.
Source§fn property(&self) -> AllocationProperty
fn property(&self) -> AllocationProperty
Returns memory property for the current allocation.
Source§unsafe fn memory_mut(
&mut self,
_policy: AccessPolicy,
) -> Result<&mut [MaybeUninit<u8>], AccessError>
unsafe fn memory_mut( &mut self, _policy: AccessPolicy, ) -> Result<&mut [MaybeUninit<u8>], AccessError>
Returns a mutable view of the memory of the whole allocation, subject to
policy. Read moreSource§fn memory(
&self,
_policy: AccessPolicy,
) -> Result<&[MaybeUninit<u8>], AccessError>
fn memory( &self, _policy: AccessPolicy, ) -> Result<&[MaybeUninit<u8>], AccessError>
Returns a view of the memory of the whole allocation, subject to
policy. Read moreSource§fn capacity(&self) -> usize
fn capacity(&self) -> usize
The total byte capacity of the allocation, WITHOUT materializing lazy storage. Read more
Source§fn split(
&mut self,
_offset: usize,
) -> Result<(Box<dyn AllocationController>, Box<dyn AllocationController>), SplitError>
fn split( &mut self, _offset: usize, ) -> Result<(Box<dyn AllocationController>, Box<dyn AllocationController>), SplitError>
Splits the current allocation in multiple separate allocations.
Source§fn view(
&self,
_start: usize,
_end: usize,
) -> Option<Box<dyn AllocationController>>
fn view( &self, _start: usize, _end: usize, ) -> Option<Box<dyn AllocationController>>
Returns a zero-copy controller over the sub-range
[start, end) of this
allocation when the backend supports cheap sub-views (files and shared
buffers), borrowing &self. Returns None otherwise.Source§fn duplicate(&self) -> Option<Box<dyn AllocationController>>
fn duplicate(&self) -> Option<Box<dyn AllocationController>>
Duplicates the current allocation with a clone on write strategy if the allocation
controller supports it.
Source§unsafe fn copy_into(&self, buf: &mut [u8])
unsafe fn copy_into(&self, buf: &mut [u8])
Reads the data from the current allocation controller and copy its content into the provided
buffer. Read more
Auto Trait Implementations§
impl !Sync for PinnedMemoryAllocController
impl Freeze for PinnedMemoryAllocController
impl RefUnwindSafe for PinnedMemoryAllocController
impl Send for PinnedMemoryAllocController
impl Unpin for PinnedMemoryAllocController
impl UnsafeUnpin for PinnedMemoryAllocController
impl UnwindSafe for PinnedMemoryAllocController
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more