Struct infinitree::fields::LinkedList [−][src]
pub struct LinkedList<T: 'static> { /* fields omitted */ }
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
Auto Trait Implementations
impl<T> !RefUnwindSafe for LinkedList<T>
impl<T> Send for LinkedList<T>
impl<T> Sync for LinkedList<T>
impl<T> Unpin for LinkedList<T>
impl<T> !UnwindSafe for LinkedList<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more