pub struct Builder<T> { /* private fields */ }
Expand description

A Builder facilitates upgrading of a Transport for use with a Swarm.

The upgrade process is defined by the following stages:

authenticate{1} -> apply{*} -> multiplex{1}

It thus enforces the following invariants on every transport obtained from multiplex:

  1. The transport must be authenticated and multiplexed.
  2. Authentication must precede the negotiation of a multiplexer.
  3. Applying a multiplexer is the last step in the upgrade process.
  4. The Transport::Output conforms to the requirements of a Swarm, namely a tuple of a PeerId (from the authentication upgrade) and a StreamMuxer (from the multiplexing upgrade).

Implementations§

Creates a Builder over the given (base) Transport.

Upgrades the transport to perform authentication of the remote.

The supplied upgrade receives the I/O resource C and must produce a pair (PeerId, D), where D is a new I/O resource. The upgrade must thus at a minimum identify the remote, which typically involves the use of a cryptographic authentication protocol in the context of establishing a secure channel.

Transitions
  • I/O upgrade: C -> (PeerId, D).
  • Transport output: C -> (PeerId, D)

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.

Should always be Self
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.