pub struct LinkedList<T: 'static> { /* private fields */ }
Expand description

Append-only linked list that only commits incremental changes

Implementations§

Add a new item to the list

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();
list.push(123456);

assert_eq!(list.last(), Some(123456.into()))

Gets the first item of the current commit

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();

list.push(123456);
assert_eq!(list.first_in_commit(), Some(123456.into()));

list.push(111111);
assert_eq!(list.first_in_commit(), Some(123456.into()));

list.commit();
assert_eq!(list.first_in_commit(), None);

list.push(654321);
assert_eq!(list.first_in_commit(), Some(654321.into()));

Gets the first item of the linked list

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();
list.push(123456);

assert_eq!(list.first(), Some(123456.into()));

list.push(111111);

assert_eq!(list.first(), Some(123456.into()));

Gets the last item of the linked list

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();

list.push(123456);
assert_eq!(list.last(), Some(123456.into()));

list.push(111111);
assert_eq!(list.last(), Some(111111.into()));

Move the commit pointer to the last item in the list

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();

list.push(123456);
assert_eq!(list.first_in_commit(), Some(123456.into()));

list.push(111111);
assert_eq!(list.first_in_commit(), Some(123456.into()));

list.commit();
assert_eq!(list.first_in_commit(), None);

list.push(654321);
assert_eq!(list.first_in_commit(), Some(654321.into()));

Move the commit pointer to the last item in the list

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();

list.push(123456);
list.push(111111);
list.commit();
list.push(654321);
assert_eq!(list.first_in_commit(), Some(654321.into()));
assert_eq!(list.last(), Some(654321.into()));
assert_eq!(list.first(), Some(123456.into()));

list.clear();
assert_eq!(list.first_in_commit(), None);
assert_eq!(list.first(),None);
assert_eq!(list.last(), None);

Move the commit pointer to the last item in the list

Examples
use infinitree::fields::LinkedList;

let list = LinkedList::default();

list.push(123456);
list.push(111111);
list.commit();
list.push(654321);
assert_eq!(list.first_in_commit(), Some(654321.into()));
assert_eq!(list.last(), Some(654321.into()));
assert_eq!(list.first(), Some(123456.into()));

list.rollback();
assert_eq!(list.first_in_commit(), None);
assert_eq!(list.first(), Some(123456.into()));
assert_eq!(list.last(), Some(111111.into()));

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
Generate an Intent wrapper for each field in the Index. Read more
Generate an Intent wrapper for each field in the Index. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.