[][src]Struct samurai::bucket::Bucket

pub struct Bucket { /* fields omitted */ }

Methods

impl Bucket[src]

pub fn new(max_nodes: usize, start_id: Id, end_id: Id) -> Self[src]

pub fn add_node(&mut self, node: &Node) -> Result<(), BucketError>[src]

Add a new ndoe, can fail if the bucket is full, if the node should not be inside this bucket and if the node is Local but there already is a local node in this bucket.

pub fn rm_node(&mut self, id: Id)[src]

Remove a node by its ID

pub fn local(&self) -> Result<Node, BucketError>[src]

Check if the bucket contains the node that represents us

pub fn divide(&mut self) -> Option<Self>[src]

Divide bucket and split the ID space between the two. It also moves the nodes to the new bucket if necessary.

pub fn get(&self, i: usize) -> Result<Node, BucketError>[src]

Get a node from the bucket by its index, can fail if index is incorrect.

pub fn get_by_id(&self, id: &Id) -> Result<Node, BucketError>[src]

Get a node from the bucket by its ID.

pub fn fits(&self, id: &Id) -> bool[src]

Check if a node fits inside the bucket (in terms of ID)

pub fn nodes(&self) -> &Vec<Node>[src]

Get list of nodes inside a bucket

Trait Implementations

impl Debug for Bucket[src]

impl<'de> Deserialize<'de> for Bucket[src]

impl Serialize for Bucket[src]

Auto Trait Implementations

impl RefUnwindSafe for Bucket

impl Send for Bucket

impl Sync for Bucket

impl Unpin for Bucket

impl UnwindSafe for Bucket

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,