#[repr(C)]pub struct RelVec<T, A: RawRegionalAllocator, B: Basis = DefaultBasis> { /* private fields */ }
Expand description
A relative counterpart to Vec
.
Implementations
sourceimpl<T, A: RawRegionalAllocator, B: Basis> RelVec<T, A, B>
impl<T, A: RawRegionalAllocator, B: Basis> RelVec<T, A, B>
sourcepub fn as_ptr(this: Ref<'_, Self>) -> *const T
pub fn as_ptr(this: Ref<'_, Self>) -> *const T
Returns a raw pointer to the RelVec
’s buffer, or a dangling raw
pointer valid for zero sized reads if the RelVec
didn’t allocate.
sourcepub fn as_mut_ptr(this: Mut<'_, Self>) -> *mut T
pub fn as_mut_ptr(this: Mut<'_, Self>) -> *mut T
Returns an unsafe mutable pointer to the RelVec
’s buffer, or a
dangling raw pointer valid for zero sized reads if the RelVec
didn’t
allocate.
sourcepub unsafe fn set_len(this: Mut<'_, Self>, new_len: usize)
pub unsafe fn set_len(this: Mut<'_, Self>, new_len: usize)
Forces the length of the vector to new_len
.
Safety
new_len
must be less than or equal tocapacity()
.- The elements at
old_len..new_len
must be initialized.
sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the maximum number of elements the RelVec
can contain before
resizing.
sourcepub fn allocator(this: Ref<'_, Self>) -> Ref<'_, A>
pub fn allocator(this: Ref<'_, Self>) -> Ref<'_, A>
Returns a reference to the underlying allocator.
sourcepub fn as_slice(this: Ref<'_, Self>) -> Ref<'_, [T]>
pub fn as_slice(this: Ref<'_, Self>) -> Ref<'_, [T]>
Returns a Ref
to a slice of the elements in the RelVec
.
sourcepub fn reserve(this: Mut<'_, Self>, additional: usize)where
T: Move<A::Region>,
pub fn reserve(this: Mut<'_, Self>, additional: usize)where
T: Move<A::Region>,
Reserves capacity for at least additional
more elements to be inserted
in the given RelVec<T>
. The collection may reserve more space to
speculatively avoid frequent reallocations. After calling reserve
, the
capacity will be greater than or equal to self.len() + additional
.
Does nothing if capacity is already sufficient.
Panics
Panics if the new capacity exceeds isize::MAX
bytes.
sourcepub fn push<E>(this: Mut<'_, Self>, value: E)where
T: Move<A::Region>,
E: Emplace<T, A::Region>,
pub fn push<E>(this: Mut<'_, Self>, value: E)where
T: Move<A::Region>,
E: Emplace<T, A::Region>,
Appends an element to the back of a collection.
Panics
Panics if the new capacity exceeds isize::MAX
bytes.
Trait Implementations
sourceimpl<T, A, B> DebugRaw for RelVec<T, A, B>where
T: DebugRaw,
A: RawRegionalAllocator,
B: Basis,
impl<T, A, B> DebugRaw for RelVec<T, A, B>where
T: DebugRaw,
A: RawRegionalAllocator,
B: Basis,
sourceimpl<T, A: RawRegionalAllocator, B: Basis> DerefMutRaw for RelVec<T, A, B>
impl<T, A: RawRegionalAllocator, B: Basis> DerefMutRaw for RelVec<T, A, B>
sourcefn deref_mut_raw(this: Mut<'_, Self>) -> Mut<'_, [T]>
fn deref_mut_raw(this: Mut<'_, Self>) -> Mut<'_, [T]>
sourceimpl<T, A: RawRegionalAllocator, B: Basis> DerefRaw for RelVec<T, A, B>
impl<T, A: RawRegionalAllocator, B: Basis> DerefRaw for RelVec<T, A, B>
sourceimpl<T, A, B> DropRaw for RelVec<T, A, B>where
T: DropRaw,
A: RawRegionalAllocator + DropRaw,
B: Basis,
<B as Basis>::Usize: DropRaw,
impl<T, A, B> DropRaw for RelVec<T, A, B>where
T: DropRaw,
A: RawRegionalAllocator + DropRaw,
B: Basis,
<B as Basis>::Usize: DropRaw,
sourceimpl<T, A, B, R> Emplace<RelVec<T, A, B>, <R as RegionalAllocator>::Region> for New<R>where
T: DropRaw,
A: DropRaw + RawRegionalAllocator<Region = R::Region>,
B: Basis,
<B as Basis>::Usize: DropRaw,
R: RelAllocator<A>,
impl<T, A, B, R> Emplace<RelVec<T, A, B>, <R as RegionalAllocator>::Region> for New<R>where
T: DropRaw,
A: DropRaw + RawRegionalAllocator<Region = R::Region>,
B: Basis,
<B as Basis>::Usize: DropRaw,
R: RelAllocator<A>,
sourceimpl<T, A, B, R> Emplace<RelVec<T, A, B>, <R as RegionalAllocator>::Region> for WithCapacity<R>where
T: DropRaw,
A: DropRaw + RawRegionalAllocator<Region = R::Region>,
B: Basis,
<B as Basis>::Usize: DropRaw,
R: RelAllocator<A>,
impl<T, A, B, R> Emplace<RelVec<T, A, B>, <R as RegionalAllocator>::Region> for WithCapacity<R>where
T: DropRaw,
A: DropRaw + RawRegionalAllocator<Region = R::Region>,
B: Basis,
<B as Basis>::Usize: DropRaw,
R: RelAllocator<A>,
sourceimpl<T, A, B> IndexMutRaw<usize> for RelVec<T, A, B>where
A: RawRegionalAllocator,
B: Basis,
impl<T, A, B> IndexMutRaw<usize> for RelVec<T, A, B>where
A: RawRegionalAllocator,
B: Basis,
sourceimpl<T, A, B> IndexRaw<usize> for RelVec<T, A, B>where
A: RawRegionalAllocator,
B: Basis,
impl<T, A, B> IndexRaw<usize> for RelVec<T, A, B>where
A: RawRegionalAllocator,
B: Basis,
sourceimpl<T, A: RawRegionalAllocator, B: Basis, __R: Region> Move<__R> for RelVec<T, A, B>where
Self: DropRaw,
RelPtr<T, A::Region, B>: Move<__R>,
B::Usize: Move<__R>,
B::Usize: Move<__R>,
A: Move<__R>,
impl<T, A: RawRegionalAllocator, B: Basis, __R: Region> Move<__R> for RelVec<T, A, B>where
Self: DropRaw,
RelPtr<T, A::Region, B>: Move<__R>,
B::Usize: Move<__R>,
B::Usize: Move<__R>,
A: Move<__R>,
impl<T, A: RawRegionalAllocator, B: Basis> Portable for RelVec<T, A, B>where
RelPtr<T, A::Region, B>: Portable,
B::Usize: Portable,
B::Usize: Portable,
A: Portable,
Auto Trait Implementations
impl<T, A, B> RefUnwindSafe for RelVec<T, A, B>where
A: RefUnwindSafe,
T: RefUnwindSafe,
<B as Basis>::Isize: RefUnwindSafe,
<A as RawRegionalAllocator>::Region: RefUnwindSafe,
<B as Basis>::Usize: RefUnwindSafe,
impl<T, A, B = DefaultBasis> !Send for RelVec<T, A, B>
impl<T, A, B = DefaultBasis> !Sync for RelVec<T, A, B>
impl<T, A, B = DefaultBasis> !Unpin for RelVec<T, A, B>
impl<T, A, B> UnwindSafe for RelVec<T, A, B>where
A: UnwindSafe,
T: RefUnwindSafe,
<B as Basis>::Isize: UnwindSafe,
<A as RawRegionalAllocator>::Region: UnwindSafe,
<B as Basis>::Usize: UnwindSafe,
Blanket Implementations
sourceimpl<T, B> BasisPointee<B> for Twhere
B: Basis,
impl<T, B> BasisPointee<B> for Twhere
B: Basis,
type BasisMetadata = ()
type BasisMetadata = ()
type FromNativeError = Infallible
type FromNativeError = Infallible
type ToNativeError = Infallible
type ToNativeError = Infallible
sourcefn from_native_metadata(
<T as Pointee>::Metadata
) -> Result<<T as BasisPointee<B>>::BasisMetadata, <T as BasisPointee<B>>::FromNativeError>
fn from_native_metadata(
<T as Pointee>::Metadata
) -> Result<<T as BasisPointee<B>>::BasisMetadata, <T as BasisPointee<B>>::FromNativeError>
B
corresponding to the given native
pointer metadata, or Err
if the conversion failed. Read moresourcefn to_native_metadata(
<T as BasisPointee<B>>::BasisMetadata
) -> Result<<T as Pointee>::Metadata, <T as BasisPointee<B>>::ToNativeError>
fn to_native_metadata(
<T as BasisPointee<B>>::BasisMetadata
) -> Result<<T as Pointee>::Metadata, <T as BasisPointee<B>>::ToNativeError>
B
, or Err
if the conversion failed. Read more