pub struct Autoposter { /* private fields */ }Expand description
Background task that calls TopTL::post_stats on an interval.
§Example
use std::sync::Arc;
use std::time::Duration;
use toptl::{StatsPayload, TopTL};
use toptl::autoposter::Autoposter;
#[tokio::main]
async fn main() {
let client = TopTL::new("toptl_xxx");
let autoposter = Autoposter::new(client, "mybot")
.interval(Duration::from_secs(30 * 60))
.callback(Arc::new(|| StatsPayload {
member_count: Some(5_000),
group_count: Some(1_200),
channel_count: Some(300),
bot_serves: None,
}))
.start();
// autoposter.stop().await;
}Implementations§
Source§impl Autoposter
impl Autoposter
Auto Trait Implementations§
impl Freeze for Autoposter
impl !RefUnwindSafe for Autoposter
impl Send for Autoposter
impl Sync for Autoposter
impl Unpin for Autoposter
impl UnsafeUnpin for Autoposter
impl !UnwindSafe for Autoposter
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