[−][src]Struct swim_mem::resident::Buf
A resizeable array of values, residing in a memory Lease
. A Buf
is a
Resident
typeclass; it doesn't store any data in its internal structure.
Rather, Buf
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 Buf
type.
Lease
implementations commonly composed with a Buf
include:
Own<Buf<T>>
: the exclusive owner of a relocatable, resizeable array.Mut<Buf<T>>
: a mutably dereferenceable strong owner of an unrelocatable, resizeable array.Ref<Buf<T>>
: an immutably dereferenceable strong owner of an unrelocatable, resizeable array.Hard<Buf<T>>
: an undereferenceable strong owner of a relocatable array.Soft<Buf<T>>
: an undereferenceable weak owner of a relocatable array.
Buf
implements LeaseDeref
, and LeaseDerefMut
, which enables deref
coercions from Own<Buf<T>>
, Mut<Buf<T>>
, and Ref<Buf<T>>
to
&BufLease<L, T>
. BufLease
in turn deref coerces to &[T]
and
&mut [T]
. This makes leased bufs "feel" like they contain a slice, even
though Buf
is just a typeclass for accessing the slice stored in the
composing memory Lease
. Most buffer operations are defined on BufLease
;
Buf
can't do much on its own since it doesn't actually contain any data.
Trait Implementations
impl<T, M> Resident for Buf<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 = BufHeader<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 BufHeader<M>) -> usize
[src]
unsafe fn resident_drop(data: *mut T, meta: *mut BufHeader<M>)
[src]
impl<'a, L: Lease<Data = T, Meta = BufHeader<M>> + Holder<'a>, T, U: CloneIntoHold<'a, T>, M> ResidentFromClone<L, [U], M> for Buf<T, M>
[src]
fn new_resident_layout(data: &[U], _meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, _data: &[U], _meta: &M) -> *mut T
[src]
fn new_resident(lease: &mut L, data: &[U], meta: M)
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T: Copy, M> ResidentFromCopy<L, [T], M> for Buf<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 = u8, Meta = BufHeader<M>>, M> ResidentFromCopy<L, str, M> for Buf<u8, M>
[src]
fn new_resident_layout(data: &str, _meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, _data: &str, _meta: &M) -> *mut u8
[src]
fn new_resident(lease: &mut L, data: &str, meta: M)
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentFromEmpty<L, M> for Buf<T, M>
[src]
fn new_resident_layout(_meta: &M) -> Layout
[src]
fn new_resident_ptr(raw: *mut u8, _meta: &M) -> *mut T
[src]
fn new_resident(lease: &mut L, meta: M)
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentWithCapacity<L, M> for Buf<T, M>
[src]
fn new_resident_layout(cap: usize, _meta: &M) -> Result<Layout, LayoutError>
[src]
fn new_resident_ptr(raw: *mut u8, _cap: usize, _meta: &M) -> *mut T
[src]
fn new_resident(lease: &mut L, cap: usize, meta: M)
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentDeref<L> for Buf<T, M>
[src]
type Target = BufLease<L, T, M>
The type the resident dereferences to.
fn resident_deref(lease: &L) -> &BufLease<L, T, M>
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentDerefMut<L> for Buf<T, M>
[src]
fn resident_deref_mut(lease: &mut L) -> &mut BufLease<L, T, M>
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentAsRef<L, [T]> for Buf<T, M>
[src]
fn resident_as_ref(lease: &L) -> &[T]
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentAsMut<L, [T]> for Buf<T, M>
[src]
fn resident_as_mut(lease: &mut L) -> &mut [T]
[src]
impl<L: Lease<Meta = BufHeader<M>>, Idx: SliceIndex<[L::Data]>, M> ResidentIndex<L, Idx> for Buf<L::Data, M> where
L::Data: Sized,
[src]
L::Data: Sized,
type Output = Idx::Output
The type of values indexed by the resident for the parameterized Idx
type.
fn resident_index(lease: &L, index: Idx) -> &Idx::Output
[src]
impl<L: Lease<Meta = BufHeader<M>>, Idx: SliceIndex<[L::Data]>, M> ResidentIndexMut<L, Idx> for Buf<L::Data, M> where
L::Data: Sized,
[src]
L::Data: Sized,
fn resident_index_mut(lease: &mut L, index: Idx) -> &mut Idx::Output
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T, M> ResidentIntoIterator<L> for Buf<T, M>
[src]
type Item = T
The type of element to iterator over.
type IntoIter = BufIter<L, T, M>
The type of iterator to return.
ⓘImportant traits for BufIter<L, T, M>fn resident_into_iter(lease: L) -> BufIter<L, T, M>
[src]
impl<'a, L: Lease<Data = T, Meta = BufHeader<M>>, T: 'a, M> ResidentIntoRefIterator<'a, L> for Buf<T, M>
[src]
type Item = &'a T
The type of element to iterator over.
type IntoIter = Iter<'a, T>
The type of iterator to return.
fn resident_into_iter(lease: &'a L) -> Iter<'a, T>
[src]
impl<'a, L: Lease<Data = T, Meta = BufHeader<M>>, T: 'a, M> ResidentIntoMutIterator<'a, L> for Buf<T, M>
[src]
type Item = &'a mut T
The type of element to iterator over.
type IntoIter = IterMut<'a, T>
The type of iterator to return.
fn resident_into_iter(lease: &'a mut L) -> IterMut<'a, T>
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T: PartialEq, M> ResidentPartialEq<L, L> for Buf<T, M>
[src]
fn resident_eq(lease: &L, other: &L) -> bool
[src]
fn resident_ne(lease: &L, other: &L) -> bool
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T: Eq, M> ResidentEq<L> for Buf<T, M>
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T: PartialOrd, M> ResidentPartialOrd<L, L> for Buf<T, M>
[src]
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<Data = T, Meta = BufHeader<M>>, T: Ord, M> ResidentOrd<L> for Buf<T, M>
[src]
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<Data = T, Meta = BufHeader<M>>, T: Hash, M> ResidentHash<L> for Buf<T, M>
[src]
fn resident_hash<H: Hasher>(lease: &L, state: &mut H)
[src]
impl<L: Lease<Data = T, Meta = BufHeader<M>>, T: Debug, M> ResidentDebug<L> for Buf<T, M>
[src]
fn resident_fmt(lease: &L, f: &mut Formatter) -> Result
[src]
impl<L1, L2, T, M> ResidentClone<L1, L2> for Buf<T, M> where
L1: Lease<Data = T, Meta = BufHeader<M>>,
L2: Lease<Data = T, Meta = BufHeader<M>>,
T: TryClone,
M: TryClone,
[src]
L1: Lease<Data = T, Meta = BufHeader<M>>,
L2: Lease<Data = T, Meta = BufHeader<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<'b, L1, L2, T, M> ResidentStow<'b, L1, L2> for Buf<T, M> where
L1: Lease<Data = T, Meta = BufHeader<M>>,
L2: Lease<Data = T, Meta = BufHeader<M>>,
T: TryClone,
M: TryClone,
[src]
L1: Lease<Data = T, Meta = BufHeader<M>>,
L2: Lease<Data = T, Meta = BufHeader<M>>,
T: TryClone,
M: TryClone,
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 Buf<T, M>
[src]
impl<T: Send, M: Send> Send for Buf<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,