pub struct DoublyLinkedList<T> {
pub head: Option<Box<ListNode<T>>>,
pub length: usize,
}Fields§
§head: Option<Box<ListNode<T>>>§length: usizeImplementations§
Source§impl<T> DoublyLinkedList<T>
impl<T> DoublyLinkedList<T>
Sourcepub fn new() -> DoublyLinkedList<T>
pub fn new() -> DoublyLinkedList<T>
Creates a new empty DoublyLinkedList.
§Examples
use data_structures::doubly_linked_list::DoublyLinkedList;
struct T;
let list:DoublyLinkedList<T> = DoublyLinkedList::new();
assert!(list.is_empty());Sourcepub fn with_value(data: T) -> DoublyLinkedList<T>
pub fn with_value(data: T) -> DoublyLinkedList<T>
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Checks if the DoublyLinkedList is empty.
§Returns
true if the list has no elements, and false otherwise
§Examples
use data_structures::doubly_linked_list::DoublyLinkedList;
let empty_list: DoublyLinkedList<i32> = DoublyLinkedList::new();
assert!(empty_list.is_empty());
let list: DoublyLinkedList<i32> = DoublyLinkedList::with_value(30);
assert!(!list.is_empty());Auto Trait Implementations§
impl<T> Freeze for DoublyLinkedList<T>
impl<T> RefUnwindSafe for DoublyLinkedList<T>where
T: RefUnwindSafe,
impl<T> Send for DoublyLinkedList<T>where
T: Send,
impl<T> Sync for DoublyLinkedList<T>where
T: Sync,
impl<T> Unpin for DoublyLinkedList<T>
impl<T> UnsafeUnpin for DoublyLinkedList<T>
impl<T> UnwindSafe for DoublyLinkedList<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more