Struct VecObject

Source
pub struct VecObject<T: Invariant, A: Allocator> { /* private fields */ }

Implementations§

Source§

impl<T: Invariant, A: Allocator> VecObject<T, A>

Source

pub fn object(&self) -> &Object<Vec<T, A>>

Source

pub fn into_object(self) -> Object<Vec<T, A>>

Source

pub fn iter(&self) -> VecIter<'_, T>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn capacity(&self) -> usize

Source

pub fn reserve(&mut self, additional: usize) -> Result<()>

Source

pub fn shrink_to_fit(&mut self) -> Result<()>

Source

pub fn truncate(&mut self, len: usize) -> Result<()>

Source

pub fn as_slice(&self) -> RefSlice<'_, T>

Source

pub fn slice(&self, range: impl RangeBounds<usize>) -> RefSlice<'_, T>

Source

pub fn with_mut_slice<R>( &mut self, range: impl RangeBounds<usize>, f: impl FnOnce(&mut [T]) -> Result<R>, ) -> Result<R>

Source

pub fn get_ref(&self, idx: usize) -> Option<Ref<'_, T>>

Source

pub fn swap(&mut self, a: usize, b: usize) -> Result<()>

Source

pub fn clear(&mut self) -> Result<()>

Source

pub fn retain<F>(&mut self, f: F) -> Result<()>
where F: FnMut(&T) -> bool, T: StoreCopy,

Source

pub fn first_ref(&self) -> Option<Ref<'_, T>>

Source

pub fn last_ref(&self) -> Option<Ref<'_, T>>

Source

pub fn binary_search_by<F>(&self, f: F) -> Result<usize, usize>
where F: FnMut(&T) -> Ordering,

Source

pub fn binary_search_by_key<B, F>(&self, b: &B, f: F) -> Result<usize, usize>
where F: FnMut(&T) -> B, B: Ord,

Source

pub fn sort(&mut self) -> Result<()>
where T: Ord,

Source

pub fn sort_by<F>(&mut self, compare: F) -> Result<()>
where F: FnMut(&T, &T) -> Ordering,

Source

pub fn sort_by_key<K, F>(&mut self, f: F) -> Result<()>
where F: FnMut(&T) -> K, K: Ord,

Source

pub fn sort_unstable(&mut self) -> Result<()>
where T: Ord,

Source

pub fn sort_unstable_by<F>(&mut self, compare: F) -> Result<()>
where F: FnMut(&T, &T) -> Ordering,

Source

pub fn sort_unstable_by_key<K, F>(&mut self, f: F) -> Result<()>
where F: FnMut(&T) -> K, K: Ord,

Source

pub fn reverse(&mut self) -> Result<()>

Source

pub fn starts_with(&self, needle: &[T]) -> bool
where T: PartialEq,

Source

pub fn ends_with(&self, needle: &[T]) -> bool
where T: PartialEq,

Source

pub fn contains(&self, x: &T) -> bool
where T: PartialEq,

Source

pub fn with_slice<R>(&self, f: impl FnOnce(&[T]) -> R) -> R

Source

pub fn with_slice_mut<R>( &mut self, f: impl FnOnce(&mut [T]) -> Result<R>, ) -> Result<R>

Source§

impl<T: Invariant + StoreCopy, A: Allocator> VecObject<T, A>

Source

pub fn push(&mut self, val: T) -> Result<()>

Source

pub fn append(&mut self, vals: impl IntoIterator<Item = T>) -> Result<()>

Source

pub fn pop(&mut self) -> Result<Option<T>>

Source

pub fn remove(&mut self, idx: usize) -> Result<T>

Source

pub fn split_off(&mut self, _point: usize) -> Result<Self>

Source

pub fn swap_remove(&mut self, _idx: usize) -> Result<T>

Source§

impl<T: Invariant> VecObject<T, VecObjectAlloc>

Source

pub fn new(builder: ObjectBuilder<Vec<T, VecObjectAlloc>>) -> Result<Self>

Source§

impl<T: Invariant, A: Allocator + SingleObjectAllocator> VecObject<T, A>

Source

pub fn push_inplace(&mut self, val: T) -> Result<()>

Source

pub fn append_inplace( &mut self, vals: impl IntoIterator<Item = T>, ) -> Result<()>

Source

pub fn push_ctor<F>(&mut self, ctor: F) -> Result<()>
where F: FnOnce(RefMut<'_, MaybeUninit<T>>) -> Result<RefMut<'_, T>>,

Source

pub fn remove_inplace(&mut self, idx: usize) -> Result<()>

Source

pub fn swap_remove_inplace(&mut self, _idx: usize) -> Result<()>

Trait Implementations§

Source§

impl<T: Invariant, A: Allocator> Clone for VecObject<T, A>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Invariant + StoreCopy, A: Allocator> Extend<T> for VecObject<T, A>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T: Invariant, A: Allocator> From<Object<Vec<T, A>>> for VecObject<T, A>

Source§

fn from(value: Object<Vec<T, A>>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: Invariant, A: Allocator> IntoIterator for &'a VecObject<T, A>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = VecIter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<T, A> Freeze for VecObject<T, A>

§

impl<T, A> !ObjSafe for VecObject<T, A>

§

impl<T, A> RefUnwindSafe for VecObject<T, A>

§

impl<T, A> Send for VecObject<T, A>

§

impl<T, A> !StoreCopy for VecObject<T, A>

§

impl<T, A> Sync for VecObject<T, A>

§

impl<T, A> Unpin for VecObject<T, A>

§

impl<T, A> UnwindSafe for VecObject<T, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more