rckad

Crates.iorckad
lib.rsrckad
version0.1.0
sourcesrc
created_at2019-06-13 01:36:00.130821
updated_at2020-09-25 08:00:46.491056
descriptionEfficient and flexible Kademlia implementation.
homepage
repositoryhttps://github.com/rust-cc/rckad
max_upload_size
id140732
size30,168
Neo Sun (sunhuachuang)

documentation

README

Latest Version

rckad

Efficient and flexible S/Kademlia implementation. (no-std)

use rckad::KadTree;

fn main() {
    let mut kad = KadTree::new(0, "0");
    kad.add(2, "b");
    kad.add(3, "c");
    kad.add(4, "e");

    assert_eq!(Some((&2, &"b", true)), kad.search(&2));
    assert_eq!(true, kad.contains(&2));

    kad.remove(&2);
    assert_eq!(false, kad.contains(&2));

    let mut kad = KadTree::with_k_bucket(0, "0".to_owned(), 2);

    for i in 1..(256 * 2 + 2) {
        kad.add(i, format!("{}", i));
    }

    assert_eq!(Some((&61, &"61".to_owned(), false)), kad.search(&131));
}

License

This project is licensed under, it's your choice.

Commit count: 17

cargo fmt