Struct ArrayList

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

Implementations§

Source§

impl<T: Debug + Clone + PartialEq> ArrayList<T>

Source

pub fn new() -> Self

Source

pub fn start_with(collection: &[T]) -> Self

Source

pub fn push(&self, value: T) -> bool

Source

pub fn push_on_index(&self, index: usize, value: T)

Source

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

Source

pub fn add_all(&self, collection: &[T])

Source

pub fn add_all_at_index(&self, idx: usize, collection: &[T])

Source

pub fn replace(&self, index: usize, value: T)

Source

pub fn clear(&self)

Source

pub fn clone(&self) -> Self

Source

pub fn copy(&self) -> &Self

Source

pub fn add(&mut self, value: T) -> &mut Self

Source

pub fn finish(&self) -> Self

Source

pub fn ensure_capacity(size: usize) -> Self

Source

pub fn contains(&self, value: T) -> bool

Source

pub fn cap(&self) -> usize

Source

pub fn len(&self) -> usize

Source

pub fn size(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

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

Source

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

Source

pub fn remove_if(&self, f: fn(T) -> bool)

Source

pub fn to_vec(&self) -> Vec<T>

Source

pub fn from_slice(collection: &[T]) -> Self

Source

pub fn for_each(&self, f: fn(T))

Source

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

Source

pub fn sub_list(&self, start: usize, stop: usize) -> Option<ArrayList<T>>

Source

pub fn index_of(&self, value: T) -> Option<usize>

Source

pub fn index_of_all(&self, value: T) -> Vec<usize>

Source

pub fn index_in(&self, value: usize) -> Option<T>

Source

pub fn print(&self)

Source

pub fn swap(&self, first_idx: usize, second_idx: usize)

use arraylist::{arl::ArrayList, arraylist};

let langs = arraylist!["clojure", "golang", "kotlin", "groovy"];
langs.swap(0, 2);
assert_eq!(
   langs.to_vec(),
   ["kotlin", "golang", "clojure", "groovy"].to_vec()
);

Trait Implementations§

Source§

impl<T: Debug> Debug for ArrayList<T>

Source§

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

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

impl<T: Debug + Clone + PartialEq> Default for ArrayList<T>

Source§

fn default() -> Self

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

impl<T: Display + Clone> Display for ArrayList<T>

Source§

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

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

impl<T: Clone + PartialEq + Debug> FromIterator<T> for ArrayList<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: Clone> IntoIterator for ArrayList<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<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
Source§

impl<T: PartialEq> PartialEq for ArrayList<T>

Source§

fn eq(&self, other: &ArrayList<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> StructuralPartialEq for ArrayList<T>

Auto Trait Implementations§

§

impl<T> !Freeze for ArrayList<T>

§

impl<T> !RefUnwindSafe for ArrayList<T>

§

impl<T> !Send for ArrayList<T>

§

impl<T> !Sync for ArrayList<T>

§

impl<T> Unpin for ArrayList<T>

§

impl<T> !UnwindSafe for ArrayList<T>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.