Struct ChannelRouteAdapter
pub struct ChannelRouteAdapter { /* private fields */ }Expand description
A route adapter that delivers approval notices to configured channels.
channels is keyed by the channel-map key (<channel>.<alias> or bare
<channel>), the same keys build_channel_map produces. A route string is
channel_key:recipient (e.g. discord.ops:123456789012345678); the
channel_key selects the channel, the recipient is that channel’s addressee.
Implementations§
Source§impl ChannelRouteAdapter
impl ChannelRouteAdapter
Sourcepub fn new(channels: HashMap<String, Arc<dyn Channel>>, handle: Handle) -> Self
pub fn new(channels: HashMap<String, Arc<dyn Channel>>, handle: Handle) -> Self
Build from a channel map and the tokio runtime handle to spawn sends onto.
The daemon passes tokio::runtime::Handle::current() from its async context;
capturing it here (rather than calling Handle::current() inside deliver)
keeps deliver callable from the sync engine without panicking off-runtime.
Trait Implementations§
Source§impl ApprovalRouteAdapter for ChannelRouteAdapter
impl ApprovalRouteAdapter for ChannelRouteAdapter
fn deliver( &self, kind: ApprovalNoticeKind, route: &str, notice: &GateNotice<'_>, ) -> Result<()>
Auto Trait Implementations§
impl Freeze for ChannelRouteAdapter
impl !RefUnwindSafe for ChannelRouteAdapter
impl Send for ChannelRouteAdapter
impl Sync for ChannelRouteAdapter
impl Unpin for ChannelRouteAdapter
impl UnsafeUnpin for ChannelRouteAdapter
impl !UnwindSafe for ChannelRouteAdapter
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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