pub struct XdcAppBuilder { /* private fields */ }Expand description
Declares a Mini App handler: which apps, when to join, and what to do
with each session. From VectorBot::xdc; does nothing until run.
Implementations§
Source§impl XdcAppBuilder
impl XdcAppBuilder
Sourcepub fn join_when(self, when: JoinWhen) -> Self
pub fn join_when(self, when: JoinWhen) -> Self
Join when the app is shared rather than only when it is opened.
Sourcepub fn idle_timeout(self, idle: Option<Duration>) -> Self
pub fn idle_timeout(self, idle: Option<Duration>) -> Self
End a session after this long with nobody connected; the handler’s
next returns None. Default 3 minutes; None keeps
sessions until the handler returns.
Sourcepub fn quiet_timeout(self, quiet: Option<Duration>) -> Self
pub fn quiet_timeout(self, quiet: Option<Duration>) -> Self
End a session after this long with no frames from anyone, even with
peers connected. Default 15 minutes; None disables it.
Sourcepub fn max_sessions(self, n: usize) -> Self
pub fn max_sessions(self, n: usize) -> Self
At most this many sessions of this handler at once (default 32).
Sourcepub fn max_per_chat(self, n: usize) -> Self
pub fn max_per_chat(self, n: usize) -> Self
At most this many sessions of this handler in any one chat (default 4), so one chat can’t take every slot.
Sourcepub fn run<F, Fut>(self, handler: F)
pub fn run<F, Fut>(self, handler: F)
Register the handler. It runs once per session, in its own task. The
session ends when the handler returns, or earlier when its
idle_timeout (3 min alone) or
quiet_timeout (15 min without frames) runs out:
next then returns None. Register before the bot
starts listening.
Auto Trait Implementations§
impl Forget for XdcAppBuilder
impl Freeze for XdcAppBuilder
impl Move for XdcAppBuilder
impl RefUnwindSafe for XdcAppBuilder
impl Send for XdcAppBuilder
impl Sync for XdcAppBuilder
impl Unpin for XdcAppBuilder
impl UnsafeUnpin for XdcAppBuilder
impl UnwindSafe for XdcAppBuilder
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
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> ⓘ
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