[][src]Struct drumatech::structure::ArrayQueue

pub struct ArrayQueue<T> {
    pub head: usize,
    pub size: usize,
    pub contents: Vec<T>,
    pub cap: usize,
}

Fields

head: usizesize: usizecontents: Vec<T>cap: usize

Methods

impl<T: Clone> ArrayQueue<T>[src]

pub fn new(contents: Vec<T>) -> ArrayQueue<T>[src]

pub fn resize(&mut self)[src]

pub fn update(&mut self)[src]

pub fn add(&mut self, x: T) -> bool[src]

add the value with resizing contents capacities.

Examples

extern crate drumatech;
use drumatech::structure;
let mut arys : structure::ArrayQueue<u8> = structure::ArrayQueue::new(vec![1,2,3,4,5]);
arys.add(30);
assert_eq!(arys.contents.len(),6);
assert_eq!(1,arys.contents[0]);
assert_eq!(30,arys.contents[arys.size-1]);

pub fn remove(&mut self) -> T[src]

remove the value with resizing contents capacities.

Examples

extern crate drumatech;
use drumatech::structure;
let mut arys : structure::ArrayQueue<u8> = structure::ArrayQueue::new(vec![1,2,3,4,5]);
assert_eq!(1,arys.remove());
assert_eq!(arys.contents.len(),4);
arys.add(30);
assert_eq!(arys.contents.len(),5);

Auto Trait Implementations

impl<T> Send for ArrayQueue<T> where
    T: Send

impl<T> Sync for ArrayQueue<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]