[−][src]Struct samurai::bucket::Bucket
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,