Skip to main content

AbsoluteLinkedList

Trait AbsoluteLinkedList 

Source
pub trait AbsoluteLinkedList<T: LinkType>: LinkedList<T> {
    // Required methods
    fn get_first(&self) -> T;
    fn get_last(&self) -> T;
    fn get_size(&self) -> T;
    fn set_first(&mut self, element: T);
    fn set_last(&mut self, element: T);
    fn set_size(&mut self, size: T);

    // Provided methods
    fn inc_size(&mut self) { ... }
    fn dec_size(&mut self) { ... }
}
Expand description

Linked list with direct (absolute) access to the first and last elements and a size counter.

This is typically used when a single list instance owns its own head/tail/size metadata. For multiple lists sharing the same storage, see RelativeLinkedList.

Required Methods§

Source

fn get_first(&self) -> T

Returns the first element (head) of the list, or T::funty(0) if empty.

Source

fn get_last(&self) -> T

Returns the last element (tail) of the list, or T::funty(0) if empty.

Source

fn get_size(&self) -> T

Returns the number of elements in the list.

Source

fn set_first(&mut self, element: T)

Sets the first element (head) of the list.

Source

fn set_last(&mut self, element: T)

Sets the last element (tail) of the list.

Source

fn set_size(&mut self, size: T)

Sets the size of the list.

Provided Methods§

Source

fn inc_size(&mut self)

Increments the list size by one.

Source

fn dec_size(&mut self)

Decrements the list size by one.

Implementors§