Expand description
An allocated SSlice<T, S>
instance.
Implementations
sourceimpl<T, S: Sentinel<T>, A: Allocator> SBox<T, S, A>
impl<T, S: Sentinel<T>, A: Allocator> SBox<T, S, A>
sourcepub fn from_sslice_in(
slice: &SSlice<T, S>,
allocator: A
) -> Result<Self, AllocError> where
T: Clone,
pub fn from_sslice_in(
slice: &SSlice<T, S>,
allocator: A
) -> Result<Self, AllocError> where
T: Clone,
Clones the content of slice
into a SBox<T, S>
.
sourcepub fn copy_sslice_in(
slice: &SSlice<T, S>,
allocator: A
) -> Result<Self, AllocError> where
T: Copy,
pub fn copy_sslice_in(
slice: &SSlice<T, S>,
allocator: A
) -> Result<Self, AllocError> where
T: Copy,
Copies the content of slice
into a SBox<T, S>
.
sourcepub fn into_raw_parts(b: SBox<T, S, A>) -> (*mut T, A)
pub fn into_raw_parts(b: SBox<T, S, A>) -> (*mut T, A)
Turns the provided SBox<T, S>
into its raw representation.
The returned pointer can be used to re-construct a box using from_raw_parts
.
sourcepub unsafe fn from_raw_parts(data: *mut T, allocator: A) -> Self
pub unsafe fn from_raw_parts(data: *mut T, allocator: A) -> Self
Constructs a new SBox<T, S>
using the provided data pointer and allocator.
Safety
The provided pointer must reference the first element of a SSlice<T, S>
instance
allocated by allocator
.
sourceimpl<T, S: Sentinel<T>> SBox<T, S>
impl<T, S: Sentinel<T>> SBox<T, S>
sourcepub fn from_sslice(slice: &SSlice<T, S>) -> Result<Self, AllocError> where
T: Clone,
pub fn from_sslice(slice: &SSlice<T, S>) -> Result<Self, AllocError> where
T: Clone,
Clones the content of slice
into a SBox<T, S>
.
sourcepub fn copy_sslice(slice: &SSlice<T, S>) -> Result<Self, AllocError> where
T: Copy,
pub fn copy_sslice(slice: &SSlice<T, S>) -> Result<Self, AllocError> where
T: Copy,
Copies the content of slice
into a SBox<T, S>
.
Methods from Deref<Target = SSlice<T, S>>
sourcepub fn display(&self) -> &DisplayCStr
pub fn display(&self) -> &DisplayCStr
An implementation of fmt::Display
and fmt::Debug
for the CStr
type.
When an invalid character is found, a replacement character is displayed instead.
sourcepub fn as_ptr(&self) -> *const T
pub fn as_ptr(&self) -> *const T
Returns a pointer to the first element that is part of the slice.
sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns a pointer to the first element that is part of the slice.
sourcepub fn iter(&self) -> &Iter<T, S>ⓘNotable traits for &'a Iter<T, S>impl<'a, T, S: Sentinel<T>> Iterator for &'a Iter<T, S> type Item = &'a T;impl<'a, T, S: Sentinel<T>> Iterator for &'a mut Iter<T, S> type Item = &'a mut T;
pub fn iter(&self) -> &Iter<T, S>ⓘNotable traits for &'a Iter<T, S>impl<'a, T, S: Sentinel<T>> Iterator for &'a Iter<T, S> type Item = &'a T;impl<'a, T, S: Sentinel<T>> Iterator for &'a mut Iter<T, S> type Item = &'a mut T;
Returns an iterator over the elements of the slice.
sourcepub fn iter_mut(&mut self) -> &mut Iter<T, S>ⓘNotable traits for &'a Iter<T, S>impl<'a, T, S: Sentinel<T>> Iterator for &'a Iter<T, S> type Item = &'a T;impl<'a, T, S: Sentinel<T>> Iterator for &'a mut Iter<T, S> type Item = &'a mut T;
pub fn iter_mut(&mut self) -> &mut Iter<T, S>ⓘNotable traits for &'a Iter<T, S>impl<'a, T, S: Sentinel<T>> Iterator for &'a Iter<T, S> type Item = &'a T;impl<'a, T, S: Sentinel<T>> Iterator for &'a mut Iter<T, S> type Item = &'a mut T;
Returns an iterator over the elements of the slice.
sourcepub unsafe fn get_unchecked<Idx>(&self, index: Idx) -> &Idx::Output where
Idx: SliceIndex<T, S>,
pub unsafe fn get_unchecked<Idx>(&self, index: Idx) -> &Idx::Output where
Idx: SliceIndex<T, S>,
Indexes into this SSlice<T, S>
instance without checking the bounds.
Safety
index
must be in bounds.
sourcepub unsafe fn get_unchecked_mut<Idx>(&mut self, index: Idx) -> &mut Idx::Output where
Idx: SliceIndex<T, S>,
pub unsafe fn get_unchecked_mut<Idx>(&mut self, index: Idx) -> &mut Idx::Output where
Idx: SliceIndex<T, S>,
Indexes into this SSlice<T, S>
instance without checking the bounds.
Safety
index
must be in bounds.
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the SSlice<T, S>
. This is the number of elements referenced by
that instance, not including the terminating sentinel character.
sourcepub fn first(&self) -> Option<&T>
pub fn first(&self) -> Option<&T>
Returns the first element of the slice, or None
if it is empty.
sourcepub fn first_mut(&mut self) -> Option<&mut T>
pub fn first_mut(&mut self) -> Option<&mut T>
Returns the first element of the slice, or None
if it is empty.
sourcepub fn split_first(&self) -> Option<(&T, &Self)>
pub fn split_first(&self) -> Option<(&T, &Self)>
Returns a pointer to the first element of the slice, and a slice to the remaining elements.
None
is returned if the slice is empty.
sourcepub fn split_first_mut(&mut self) -> Option<(&mut T, &mut Self)>
pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut Self)>
Returns a pointer to the first element of the slice, and a slice to the remaining elements.
None
is returned if the slice is empty.
sourcepub unsafe fn raw_first(&self) -> &T
pub unsafe fn raw_first(&self) -> &T
Returns a shared reference to the first element of the slice, or a sentinel value if the slice is empty.
Safety
If the returned value is a sentinel, it must not be modified (or rather, it must remain a sentinel).
sourcepub unsafe fn raw_first_mut(&mut self) -> &mut T
pub unsafe fn raw_first_mut(&mut self) -> &mut T
Returns an exclusive reference to the first element of the slice, or a sentinel value if the slice is empty.
Safety
If the returned value is a sentinel, it must not be modified (or rather, it must remain a sentinel).
Trait Implementations
sourceimpl<T, S: Sentinel<T>, A: Allocator> BorrowMut<SSlice<T, S>> for SBox<T, S, A>
impl<T, S: Sentinel<T>, A: Allocator> BorrowMut<SSlice<T, S>> for SBox<T, S, A>
sourcefn borrow_mut(&mut self) -> &mut SSlice<T, S>
fn borrow_mut(&mut self) -> &mut SSlice<T, S>
Mutably borrows from an owned value. Read more
sourceimpl<T, S, A> Ord for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
T: Ord,
impl<T, S, A> Ord for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
T: Ord,
sourceimpl<T, S, T2, S2, A> PartialEq<SBox<T, S, A>> for SSlice<T2, S2> where
S: Sentinel<T>,
S2: Sentinel<T2>,
A: Allocator,
T2: PartialEq<T>,
impl<T, S, T2, S2, A> PartialEq<SBox<T, S, A>> for SSlice<T2, S2> where
S: Sentinel<T>,
S2: Sentinel<T2>,
A: Allocator,
T2: PartialEq<T>,
sourceimpl<T, S, T2, A> PartialEq<SBox<T, S, A>> for [T2] where
S: Sentinel<T>,
A: Allocator,
T2: PartialEq<T>,
impl<T, S, T2, A> PartialEq<SBox<T, S, A>> for [T2] where
S: Sentinel<T>,
A: Allocator,
T2: PartialEq<T>,
sourceimpl<T, S, T2, A, const N: usize> PartialEq<SBox<T, S, A>> for [T2; N] where
S: Sentinel<T>,
A: Allocator,
T2: PartialEq<T>,
impl<T, S, T2, A, const N: usize> PartialEq<SBox<T, S, A>> for [T2; N] where
S: Sentinel<T>,
A: Allocator,
T2: PartialEq<T>,
sourceimpl<T, S, U, A> PartialEq<U> for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
SSlice<T, S>: PartialEq<U>,
impl<T, S, U, A> PartialEq<U> for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
SSlice<T, S>: PartialEq<U>,
sourceimpl<T, S, T2, S2, A> PartialOrd<SBox<T, S, A>> for SSlice<T2, S2> where
S: Sentinel<T>,
S2: Sentinel<T2>,
A: Allocator,
T2: PartialOrd<T>,
impl<T, S, T2, S2, A> PartialOrd<SBox<T, S, A>> for SSlice<T2, S2> where
S: Sentinel<T>,
S2: Sentinel<T2>,
A: Allocator,
T2: PartialOrd<T>,
sourcefn partial_cmp(&self, other: &SBox<T, S, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &SBox<T, S, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T, S, T2, A> PartialOrd<SBox<T, S, A>> for [T2] where
S: Sentinel<T>,
A: Allocator,
T2: PartialOrd<T>,
impl<T, S, T2, A> PartialOrd<SBox<T, S, A>> for [T2] where
S: Sentinel<T>,
A: Allocator,
T2: PartialOrd<T>,
sourcefn partial_cmp(&self, other: &SBox<T, S, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &SBox<T, S, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T, S, T2, A, const N: usize> PartialOrd<SBox<T, S, A>> for [T2; N] where
S: Sentinel<T>,
A: Allocator,
T2: PartialOrd<T>,
impl<T, S, T2, A, const N: usize> PartialOrd<SBox<T, S, A>> for [T2; N] where
S: Sentinel<T>,
A: Allocator,
T2: PartialOrd<T>,
sourcefn partial_cmp(&self, other: &SBox<T, S, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &SBox<T, S, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<T, S, U, A> PartialOrd<U> for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
SSlice<T, S>: PartialOrd<U>,
impl<T, S, U, A> PartialOrd<U> for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
SSlice<T, S>: PartialOrd<U>,
sourcefn partial_cmp(&self, other: &U) -> Option<Ordering>
fn partial_cmp(&self, other: &U) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T, S, A> Eq for SBox<T, S, A> where
A: Allocator,
S: Sentinel<T>,
T: Eq,
Auto Trait Implementations
impl<T, S, A> RefUnwindSafe for SBox<T, S, A> where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S = Null, A = Global> !Send for SBox<T, S, A>
impl<T, S = Null, A = Global> !Sync for SBox<T, S, A>
impl<T, S, A> Unpin for SBox<T, S, A> where
A: Unpin,
impl<T, S, A> UnwindSafe for SBox<T, S, A> where
A: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more