std-method

LinkedList::push_back

Insert an owned item at the end of the sequence. Combine with pop_front for first-in-first-out processing. Expected stdout (not executed): Some("first") Some("second") Common mistake: Using push_front when preserving arrival order matters.

Formal Syntax & Structure

rust syntaxrust
fn push_back(&mut self, elt: T)

Working Example

Example Snippetrust
fn main() {    use std::collections::LinkedList;    let mut q = LinkedList::from(["first"]);    q.push_back("second");    println!("{:?} {:?}", q.front(), q.back());}
Rust Reference