pub struct RouteBuilder<'r> { /* private fields */ }
Expand description

A utility type for building and manipulating routes.

Implementations

Push a new item to the back of the route.

Examples
let builder: RouteBuilder = Route::new()
    .append("1#alice")
    .append("bob");

// ["1#alice, "0#bob"]
let route: Route = builder.into();

Push an item with an explicit type to the back of the route.

Examples
let builder: RouteBuilder = Route::new()
    .append_t(TCP, "alice")
    .append_t(LOCAL, "bob");

// ["1#alice", "0#bob"]
let route: Route = builder.into();

Push a new item to the front of the route.

Examples
let builder: RouteBuilder = Route::new()
    .prepend("1#alice")
    .prepend("0#bob");

// ["0#bob", "1#alice"]
let route: Route = builder.into();

Prepend a full route to an existing route.

Examples
let mut route_a: Route = route!["1#alice", "bob"];
let route_b: Route = route!["1#carol", "dave"];

// ["1#carol", "0#dave", "1#alice", "0#bob"]
let route: Route = route_a.modify()
    .prepend_route(route_b)
    .into();

Replace the next item in the route with a new address.

Similar to Self::prepend(...), but drops the previous HEAD value.

Examples
let mut route: Route = route!["1#alice", "bob"];

// ["1#carol", "0#bob"]
let route: Route = route.modify()
    .replace("1#carol")
    .into();

Pop the front item from the route.

Examples
let mut route: Route = route!["1#alice", "bob", "carol"];

// ["0#bob", "carol"]
let route: Route = route.modify()
    .pop_front()
    .into();

Pop the back item from the route.

Examples
let mut route: Route = route!["1#alice", "bob", "carol"];

// ["1#alice", "0#bob"]
let route: Route = route.modify()
    .pop_back()
    .into();

Trait Implementations

Returns the “default value” for a type. Read more
Executes the destructor for this type. Read more

Convert a RouteBuilder into a Route.

Converts to this type from the input type.

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.

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