[−][src]Struct swim_mem::resident::Box
A single value, residing in a memory Lease
. A Box
is a Resident
typeclass; it doesn't store any data in its internal structure. Rather,
Box
implements an access pattern for memory blocks managed by a Lease
.
A composing Lease
type defines the memory allocation and ownership
semantics of the composed Box
type.
Lease
implementations commonly composed with a Box
include:
Own<Box<T>>
: the exclusive owner of a relocatable value.Mut<Box<T>>
: a mutably dereferenceable strong owner of an unrelocatable, reference counted value.Ref<Box<T>>
: an immutably dereferenceable strong owner of an unrelocatable, reference counted value.Hard<Box<T>>
: an undereferenceable strong owner of a relocatable, reference counted value.Soft<Box<T>>
: an undereferenceable weak owner of a relocatable, reference counted value.
Box
implements LeaseDeref
, and LeaseDerefMut
, which enables deref
coercions from Own<Box<T>>
and Mut<Box<T>>
to &T
and &mut T
,
and from Ref<Box<T>>
to &T
. This makes leased boxes "feel" like they
contain a value, even though Box
is just a typeclass for accessing the
value stored in the composing memory Lease
.
Trait Implementations
impl<T: ?Sized, M> Resident for Box<T, M>
[src]
type Data = T
The type of pointed-to data stored in leased memory blocks. The size of leased memory blocks must be a positive multiple of the Data
size. Read more
type Meta = M
The type of metadata stored with leased memory blocks. Meta
data must contain sufficient information to resolve the size of any resided-in memory Lease
. Read more
unsafe fn resident_size(data: *mut T, _meta: *mut M) -> usize
[src]
unsafe fn resident_drop(data: *mut T, _meta: *mut M)
[src]
impl<L: Lease<Data = T, Meta = M>, T, M> ResidentFromValue<L, T, M> for Box<T, M>
[src]
fn new_resident_layout(data: &T, _meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, _data: &T, _meta: &M) -> *mut T
[src]
fn new_resident(lease: &mut L, data: T, meta: M)
[src]
impl<L: Lease<Data = [T], Meta = M>, T: Clone, M> ResidentFromClone<L, [T], M> for Box<[T], M>
[src]
fn new_resident_layout(data: &[T], _meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, data: &[T], _meta: &M) -> *mut [T]
[src]
fn new_resident(lease: &mut L, data: &[T], meta: M)
[src]
impl<L: Lease<Data = [T], Meta = M>, T: Copy, M> ResidentFromCopy<L, [T], M> for Box<[T], M>
[src]
fn new_resident_layout(data: &[T], _meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, data: &[T], _meta: &M) -> *mut [T]
[src]
fn new_resident(lease: &mut L, data: &[T], meta: M)
[src]
impl<L: Lease<Data = str, Meta = M>, M> ResidentFromCopy<L, str, M> for Box<str, M>
[src]
fn new_resident_layout(data: &str, _meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, data: &str, _meta: &M) -> *mut str
[src]
fn new_resident(lease: &mut L, data: &str, meta: M)
[src]
impl<L: Lease> ResidentUnwrap<L> for Box<L::Data, L::Meta> where
L::Data: Sized,
[src]
L::Data: Sized,
type Target = L::Data
The type the resident unwraps to.
fn resident_unwrap(lease: &L) -> L::Data
[src]
impl<L: Lease> ResidentDeref<L> for Box<L::Data, L::Meta>
[src]
type Target = L::Data
The type the resident dereferences to.
fn resident_deref(lease: &L) -> &L::Data
[src]
impl<L: Lease> ResidentDerefMut<L> for Box<L::Data, L::Meta>
[src]
fn resident_deref_mut(lease: &mut L) -> &mut L::Data
[src]
impl<L: Lease> ResidentAsRef<L, <L as Lease>::Data> for Box<L::Data, L::Meta>
[src]
fn resident_as_ref(lease: &L) -> &L::Data
[src]
impl<L: Lease> ResidentAsMut<L, <L as Lease>::Data> for Box<L::Data, L::Meta>
[src]
fn resident_as_mut(lease: &mut L) -> &mut L::Data
[src]
impl<L: Lease> ResidentPartialEq<L, L> for Box<L::Data, L::Meta> where
L::Data: PartialEq,
[src]
L::Data: PartialEq,
fn resident_eq(lease: &L, other: &L) -> bool
[src]
fn resident_ne(lease: &L, other: &L) -> bool
[src]
impl<L: Lease> ResidentEq<L> for Box<L::Data, L::Meta> where
L::Data: Eq,
[src]
L::Data: Eq,
impl<L: Lease> ResidentPartialOrd<L, L> for Box<L::Data, L::Meta> where
L::Data: PartialOrd,
[src]
L::Data: PartialOrd,
fn resident_partial_cmp(lease: &L, other: &L) -> Option<Ordering>
[src]
fn resident_lt(lease: &L, other: &L) -> bool
[src]
fn resident_le(lease: &L, other: &L) -> bool
[src]
fn resident_ge(lease: &L, other: &L) -> bool
[src]
fn resident_gt(lease: &L, other: &L) -> bool
[src]
impl<L: Lease> ResidentOrd<L> for Box<L::Data, L::Meta> where
L::Data: Ord,
[src]
L::Data: Ord,
fn resident_cmp(lease: &L, other: &L) -> Ordering
[src]
fn resident_lt(lease: &L, other: &L) -> bool
[src]
fn resident_le(lease: &L, other: &L) -> bool
[src]
fn resident_ge(lease: &L, other: &L) -> bool
[src]
fn resident_gt(lease: &L, other: &L) -> bool
[src]
impl<L: Lease> ResidentHash<L> for Box<L::Data, L::Meta> where
L::Data: Hash,
[src]
L::Data: Hash,
fn resident_hash<H: Hasher>(lease: &L, state: &mut H)
[src]
impl<L: Lease> ResidentDisplay<L> for Box<L::Data, L::Meta> where
L::Data: Display,
[src]
L::Data: Display,
fn resident_fmt(lease: &L, f: &mut Formatter) -> Result
[src]
impl<L: Lease> ResidentDebug<L> for Box<L::Data, L::Meta> where
L::Data: Debug,
[src]
L::Data: Debug,
fn resident_fmt(lease: &L, f: &mut Formatter) -> Result
[src]
impl<L1, L2, T: ?Sized, M> ResidentClone<L1, L2> for Box<T, M> where
L1: Lease<Data = T, Meta = M>,
L2: Lease<Data = T, Meta = M>,
T: TryClone,
M: TryClone,
[src]
L1: Lease<Data = T, Meta = M>,
L2: Lease<Data = T, Meta = M>,
T: TryClone,
M: TryClone,
fn new_resident_layout(lease: &L1) -> Layout
[src]
fn resident_clone(src: &L1, dst: &mut L2) -> Result<(), HoldError>
[src]
impl<L1, L2, T, M> ResidentClone<L1, L2> for Box<[T], M> where
L1: Lease<Data = [T], Meta = M>,
L2: Lease<Data = [T], Meta = M>,
T: TryClone,
M: TryClone,
[src]
L1: Lease<Data = [T], Meta = M>,
L2: Lease<Data = [T], Meta = M>,
T: TryClone,
M: TryClone,
fn new_resident_layout(lease: &L1) -> Layout
[src]
fn resident_clone(src: &L1, dst: &mut L2) -> Result<(), HoldError>
[src]
impl<L1, L2, M> ResidentClone<L1, L2> for Box<str, L1::Meta> where
L1: Lease<Data = str, Meta = M>,
L2: Lease<Data = str, Meta = M>,
M: TryClone,
[src]
L1: Lease<Data = str, Meta = M>,
L2: Lease<Data = str, Meta = M>,
M: TryClone,
fn new_resident_layout(lease: &L1) -> Layout
[src]
fn resident_clone(src: &L1, dst: &mut L2) -> Result<(), HoldError>
[src]
impl<'b, L1: Lease, L2: Lease> ResidentStow<'b, L1, L2> for Box<L1::Data, L1::Meta> where
L1::Data: Stow<'b, L2::Data>,
L1::Meta: Stow<'b, L2::Meta>,
[src]
L1::Data: Stow<'b, L2::Data>,
L1::Meta: Stow<'b, L2::Meta>,
fn new_resident_layout(lease: &L1) -> Layout
[src]
unsafe fn resident_stow(
src: &mut L1,
dst: &mut L2,
hold: &dyn Hold<'b>
) -> Result<(), HoldError>
[src]
src: &mut L1,
dst: &mut L2,
hold: &dyn Hold<'b>
) -> Result<(), HoldError>
unsafe fn resident_unstow(src: &mut L1, dst: &mut L2)
[src]
impl<T: Sync, M: Sync> Sync for Box<T, M>
[src]
impl<T: Send, M: Send> Send for Box<T, M>
[src]
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,