diff options
| author | mat <github@matdoes.dev> | 2022-10-23 16:57:28 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-10-23 16:57:28 -0500 |
| commit | c9b1b19ff235975a80191d512392460c0eabfad4 (patch) | |
| tree | f2271c73b01fec675b523fb79da5b1ae83300091 /azalea/src | |
| parent | 2eade86cf7a12a6ec64496aedbfc3d3a3bd44e1a (diff) | |
| download | azalea-drasl-c9b1b19ff235975a80191d512392460c0eabfad4.tar.xz | |
Update examples with new cleaner handle/state
Diffstat (limited to 'azalea/src')
| -rw-r--r-- | azalea/src/lib.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/azalea/src/lib.rs b/azalea/src/lib.rs index 6a000e6d..148dfca7 100644 --- a/azalea/src/lib.rs +++ b/azalea/src/lib.rs @@ -22,7 +22,7 @@ //! azalea::start(azalea::Options { //! account, //! address: "localhost", -//! state: Arc::new(Mutex::new(State::default())), +//! state: State::default(), //! plugins: vec![], //! handle, //! }) @@ -33,8 +33,8 @@ //! #[derive(Default, Clone)] //! pub struct State {} //! -//! async fn handle(bot: Client, event: Arc<Event>, state: Arc<Mutex<State>>) -> anyhow::Result<()> { -//! match *event { +//! async fn handle(bot: Client, event: Event, state: State) -> anyhow::Result<()> { +//! match event { //! Event::Chat(m) => { //! println!(m.message().to_ansi(None)); //! } @@ -129,13 +129,13 @@ pub enum Error { /// it gets disconnected from the server. /// /// ```rust,no_run -/// azalea::start(azalea::Options { +/// let error = azalea::start(azalea::Options { /// account, /// address: "localhost", -/// state: Arc::new(Mutex::new(State::default())), -/// plugins: vec![&autoeat::Plugin::default()], -/// handle: Box::new(handle), -/// }).await.unwrap(); +/// state: State::default(), +/// plugins: vec![Box::new(autoeat::Plugin::default())], +/// handle, +/// }).await; /// ``` pub async fn start< S: Send + Sync + Clone + 'static, |
