pub struct Router { /* private fields */ }Expand description
Router augments MailboxRouter with additional APIs and
bookeeping relevant to meshes.
Implementations§
Source§impl Router
impl Router
Sourcepub async fn serve(
&self,
transport: &ChannelTransport,
) -> Result<ChannelAddr, ChannelError>
pub async fn serve( &self, transport: &ChannelTransport, ) -> Result<ChannelAddr, ChannelError>
Serve this router on the provided transport, returning the address. Servers are memoized, and we maintain only one per transport; thus subsequent calls using the same transport will return the same address.
Sourcepub fn bind_dial_router(&self, router: &DialMailboxRouter)
pub fn bind_dial_router(&self, router: &DialMailboxRouter)
Binds a DialMailboxRouter directly into this router. Specifically, each
prefix served by router is bound directly into this MailboxRouter.
Methods from Deref<Target = MailboxRouter>§
Sourcepub fn downgrade(&self) -> WeakMailboxRouter
pub fn downgrade(&self) -> WeakMailboxRouter
Downgrade this router to a WeakMailboxRouter.
Sourcepub fn fallback(&self, default: BoxedMailboxSender) -> impl MailboxSender
pub fn fallback(&self, default: BoxedMailboxSender) -> impl MailboxSender
Returns a new router that will first attempt to find a route for the message in the router’s table; otherwise post the message to the provided fallback sender.
Sourcepub fn bind(&self, dest: Reference, sender: impl MailboxSender + 'static)
pub fn bind(&self, dest: Reference, sender: impl MailboxSender + 'static)
Bind the provided sender to the given reference. The destination is treated as a prefix to which messages can be routed, and messages are routed to their longest matching prefix.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Router
impl !RefUnwindSafe for Router
impl Send for Router
impl Sync for Router
impl Unpin for Router
impl !UnwindSafe for Router
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more