pub trait RequesterExt: Requester {
// Provided methods
fn cache_me(self) -> CacheMe<Self> ⓘ
where Self: Sized { ... }
fn erase<'a>(self) -> ErasedRequester<'a, Self::Err> ⓘ
where Self: 'a + Sized { ... }
fn trace(self, settings: Settings) -> Trace<Self> ⓘ
where Self: Sized { ... }
fn throttle(self, limits: Limits) -> Throttle<Self> ⓘ
where Self: Sized + Clone + Send + Sync + 'static,
Self::Err: AsResponseParameters,
Self::GetChat: Send { ... }
fn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self> ⓘ
where Self: Sized { ... }
}Expand description
Extensions methods for Requester.
Provided Methods§
Sourcefn cache_me(self) -> CacheMe<Self> ⓘwhere
Self: Sized,
Available on crate feature cache_me only.
fn cache_me(self) -> CacheMe<Self> ⓘwhere
Self: Sized,
cache_me only.Add get_me caching ability, see CacheMe for more.
Sourcefn erase<'a>(self) -> ErasedRequester<'a, Self::Err> ⓘwhere
Self: 'a + Sized,
Available on crate feature erased only.
fn erase<'a>(self) -> ErasedRequester<'a, Self::Err> ⓘwhere
Self: 'a + Sized,
erased only.Erase requester type.
Sourcefn trace(self, settings: Settings) -> Trace<Self> ⓘwhere
Self: Sized,
Available on crate feature trace_adaptor only.
fn trace(self, settings: Settings) -> Trace<Self> ⓘwhere
Self: Sized,
trace_adaptor only.Trace requests, see Trace for more.
Sourcefn throttle(self, limits: Limits) -> Throttle<Self> ⓘ
Available on crate feature throttle only.
fn throttle(self, limits: Limits) -> Throttle<Self> ⓘ
throttle only.Add throttling ability, see Throttle for more.
Note: this spawns the worker, just as Throttle::new_spawn.
Sourcefn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self> ⓘwhere
Self: Sized,
fn parse_mode(self, parse_mode: ParseMode) -> DefaultParseMode<Self> ⓘwhere
Self: Sized,
Specifies default ParseMode, which will be used during all calls to:
Examples found in repository?
examples/chat_member_updates.rs (line 21)
16async fn main() -> ResponseResult<()> {
17 pretty_env_logger::init();
18
19 // We specify default parse mode to be `Html`, so that later we can use
20 // `html::user_mention`
21 let bot = teloxide_ng::Bot::from_env().parse_mode(ParseMode::Html);
22
23 // Create a handler for our bot, that will process updates from Telegram
24 let handler = dptree::entry()
25 .inspect(|u: Update| {
26 eprintln!("{u:#?}"); // Print the update to the console with inspect
27 })
28 .branch(
29 Update::filter_chat_member()
30 .branch(
31 dptree::filter(|m: ChatMemberUpdated| {
32 m.old_chat_member.is_left() && m.new_chat_member.is_present()
33 })
34 .endpoint(new_chat_member),
35 )
36 .branch(
37 dptree::filter(|m: ChatMemberUpdated| {
38 m.old_chat_member.is_present() && m.new_chat_member.is_left()
39 })
40 .endpoint(left_chat_member),
41 ),
42 );
43
44 // Create a dispatcher for our bot
45 Dispatcher::builder(bot, handler).enable_ctrlc_handler().build().dispatch().await;
46
47 Ok(())
48}Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.