pub struct Swarm<B: Backhaul, C> { /* private fields */ }
Expand description

Represents a node in an independent P2P swarm that implements a particular RPC protocol.

This is generic over a backhaul, so different transports can be plugged in easily, as well as a client-level handle (e.g. the FoobarClient that nanorpc’s macros generate from a FoobarProtocol trait). We are intentionally generic over the second one to statically prevent confusion between swarms that run incompatible RPC protocols; the combination of backhaul and client uniquely identifies a network compatible with a particular protocol.

Implementations

Creates a new Swarm given a backhaul, and a function that maps a raw transport to a client-level handle.

Obtains a connection to a peer.

Starts a listener on the given address. If advertise_addr is present, then advertise this address to peers asking for routes.

Obtains routes.

Adds a route, specifying whether or not it’s “sticky” (will never be evicted)

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.