pub struct PipeBuilder { /* private fields */ }
Expand description

A builder structure for pipes

A pipe is a unidirectional message sending abstraction, which optionally provides ordering and delivery guarantees. The two basic pipe initialisation modes are Fixed, connecting to a specific peer route, and Dynamic, connecting to a handshake worker which then creates a remote peer dynamically.

Static example

The easiest way to get started with pipes is with a static route. This requires a running PipeReceiver worker on a remote system.

Code on machine A:

let result = PipeBuilder::fixed()
    .connect(vec![tcp_connection, my_pipe])
    .build(ctx)
    .await?;

ctx.send(
    vec![result.addr(), "app".into()], // Send a message through the pipe to "app"
    String::from("Hello you on the other end of this pipe!"),
)
.await?;

Code on machine B:

let receive = PipeBuilder::fixed()
    .receive(my_pipe)
    .build(ctx)
    .await?;

let msg = ctx.receive::<String>().await?;
println!("Message from pipe: {}", msg);

Implementations

Construct a fixed pipe to a specific well-known peer

Construct a pipe using dynamic initialisation handshakes

Set a connection peer, creating an outgoing pipe

  • In fixed mode this attempts to connect directly to a receiver at the given peer route.

  • In dynamic mode this initiates a handshake with the given peer. This handshake then resolves to the final receiver

Set a receiving address, creating a receiving pipe

  • In fixed mode this creates a pipe receiver which waits for incoming messages from a sender.

  • In dynamic mode this spawns a handshake listener, which will create pipe receivers dynamically for any incoming initialisation request

Set this pipe to enforce the ordering of incoming messages

Enable the delivery guarantee behaviour on this pipe

Additional behaviours can be added to compose a custom pipe worker.

Consume this builder and construct a set of pipes

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

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 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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more