Struct AppendVec

Source
pub struct AppendVec<T> { /* private fields */ }

Implementations§

Source§

impl<T: Default> AppendVec<T>

Source

pub fn with_capacity(capacity: usize) -> Self

Creates an empty AppendVec with the given capacity.

§Examples
use crate::pi_append_vec::AppendVec;
let mut vec: AppendVec<&str> = AppendVec::with_capacity(3);
let welcome = vec.insert("Welcome");
let good_day = vec.insert("Good day");
let hello = vec.insert("Hello");
Source

pub fn len(&self) -> usize

长度

Source

pub fn get(&self, index: usize) -> Option<&T>

Source

pub unsafe fn get_unchecked(&self, index: usize) -> &T

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut T>

Source

pub unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T

Source

pub fn load(&self, index: usize) -> Option<&mut T>

Source

pub unsafe fn load_unchecked(&self, index: usize) -> &mut T

Source

pub fn alloc(&self) -> (&mut T, usize)

Source

pub fn alloc_index(&self, multiple: usize) -> usize

Source

pub fn insert(&self, value: T) -> usize

Source

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

Source

pub fn slice(&self, range: Range<usize>) -> Iter<'_, T>

Source

pub fn slice_raw(&self, range: Range<usize>) -> Iter<'_, T>

Source

pub unsafe fn set_len(&self, len: usize)

Source

pub fn capacity(&self) -> usize

Source

pub fn vec_capacity(&self) -> usize

Source

pub fn settle(&mut self, additional: usize)

将arr的内容移动到vec上,让内存连续,并且没有原子操作

Source

pub fn remain_settle(&mut self, range: Range<usize>, additional: usize)

Source

pub fn clear(&mut self, additional: usize)

清理,并释放arr的内存

Trait Implementations§

Source§

impl<T: Default + Debug> Debug for AppendVec<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for AppendVec<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T: Default> Index<usize> for AppendVec<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T: Default> IndexMut<usize> for AppendVec<T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for AppendVec<T>

§

impl<T> RefUnwindSafe for AppendVec<T>
where T: RefUnwindSafe,

§

impl<T> Send for AppendVec<T>
where T: Send,

§

impl<T> Sync for AppendVec<T>
where T: Sync,

§

impl<T> Unpin for AppendVec<T>

§

impl<T> UnwindSafe for AppendVec<T>
where T: RefUnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.
Source§

impl<T> ThreadSend for T
where T: Send,

Source§

impl<T> ThreadSync for T
where T: Sync + Send,