[][src]Struct kademlia_dht::Node

pub struct Node { /* fields omitted */ }

A node in the Kademlia DHT.

Methods

impl Node[src]

pub fn new(ip: &str, port: &str, bootstrap: Option<NodeData>) -> Self[src]

Constructs a new Node on a specific ip and port, and bootstraps the node with an existing node if bootstrap is not None.

pub fn insert(&mut self, key: Key, value: &str)[src]

Inserts a key-value pair into the DHT.

pub fn get(&mut self, key: &Key) -> Option<String>[src]

Gets the value associated with a particular key in the DHT. Returns None if the key was not found.

pub fn node_data(&self) -> NodeData[src]

Returns the NodeData associated with the node.

pub fn kill(&self)[src]

Kills the current node and all active threads.

Trait Implementations

impl Clone for Node[src]

Auto Trait Implementations

impl Send for Node

impl Sync for Node

impl Unpin for Node

impl UnwindSafe for Node

impl RefUnwindSafe for Node

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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