pub struct ChannelRouter { /* private fields */ }Expand description
Maps channel targets to projects and vice versa.
Implementations§
Source§impl ChannelRouter
impl ChannelRouter
Sourcepub fn new(
global: &GlobalChannelConfig,
projects: &[(String, ProjectChannelConfig)],
) -> Self
pub fn new( global: &GlobalChannelConfig, projects: &[(String, ProjectChannelConfig)], ) -> Self
Build router from global config + per-project configs.
Sourcepub fn resolve_project(
&self,
channel: &str,
topic_or_channel_id: &str,
) -> Option<&str>
pub fn resolve_project( &self, channel: &str, topic_or_channel_id: &str, ) -> Option<&str>
Resolve which project a channel message belongs to. Returns None if the target isn’t mapped (e.g., General channel).
Sourcepub fn is_general(&self, channel: &str, topic_or_channel_id: &str) -> bool
pub fn is_general(&self, channel: &str, topic_or_channel_id: &str) -> bool
Check if a target is the General channel.
Sourcepub fn is_control_channel(
&self,
channel: &str,
topic_or_channel_id: &str,
) -> bool
pub fn is_control_channel( &self, channel: &str, topic_or_channel_id: &str, ) -> bool
Check if a target is the configured control session channel.
Auto Trait Implementations§
impl Freeze for ChannelRouter
impl RefUnwindSafe for ChannelRouter
impl Send for ChannelRouter
impl Sync for ChannelRouter
impl Unpin for ChannelRouter
impl UnsafeUnpin for ChannelRouter
impl UnwindSafe for ChannelRouter
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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