just_linked 0.1.0

fast linked list;give you a different feeling!
Documentation
  • Coverage
  • 5.56%
    1 out of 18 items documented0 out of 17 items with examples
  • Size
  • Source code size: 22.06 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 977.32 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • luyikk/JustLinked
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • luyikk

JustLinked

fast linked list;give you a different feeling!

use just_linked::LURLinked;

fn main() {
    let mut lur = LURLinked::new();

    let one = lur.push(1);
    let tow = lur.push(2);
    let three = lur.push(3);

    assert_eq!(lur.get(one),Some(&1));
    assert_eq!(lur.get_mut(tow),Some(&mut 2));
    
    lur.move_front(one).unwrap();
    assert_eq!(lur.remove(one), Some(1));
    lur.move_front(tow).unwrap();
    assert_eq!(lur.remove(tow), Some(2));
    lur.move_front(three).unwrap();
    assert_eq!(lur.remove(three), Some(3));

    lur.push(1);
    lur.push(2);
    lur.push(3);

    assert_eq!(lur.remove_last(), Some(1));
    assert_eq!(lur.remove_last(), Some(2));
    assert_eq!(lur.remove_last(), Some(3));

    for i in 1..10i32 {
        lur.push(i);
    }

    for (_, item) in lur.iter_mut() {
        *item += 1;
    }

    for (key, value) in lur.iter() {
        println!("key:{},value:{}",key,value);
    }
    
    lur.clear();
}