forked from cwtch.im/docs.cwtch.im
Fixup rust example
This commit is contained in:
parent
b45d2c1097
commit
9ca33e1a8b
|
@ -73,7 +73,7 @@ func main() {
|
|||
This tutorial uses the Imp Cwtch Bot framework (Rust). This framework is currently a work-in-progress and the API design is subject to change. IMP is also based on libcwtch-rs which is currently based on an older pre-stable API version of Cwtch. We are planning in updating libcwtch-rs in Summer 2023.
|
||||
:::
|
||||
|
||||
```rust
|
||||
```go
|
||||
use std::borrow::BorrowMut;
|
||||
use std::thread;
|
||||
use chrono::{DateTime, FixedOffset};
|
||||
|
@ -86,7 +86,6 @@ use cwtch_imp::behaviour::*;
|
|||
use cwtch_imp::imp::Imp;
|
||||
|
||||
const BOT_HOME: &str = "~/.cwtch/bots/echobot";
|
||||
const PASSWORD: &str = "be gay do crime";
|
||||
const BOT_NAME: &str = "echobot";
|
||||
|
||||
struct Echobot {}
|
||||
|
@ -95,7 +94,7 @@ fn main() {
|
|||
let behaviour: Behaviour = BehaviourBuilder::new().name(BOT_NAME.to_string()).new_contact_policy(NewContactPolicy::Accept).build();
|
||||
let event_loop_handle = thread::spawn(move || {
|
||||
let mut echobot = Echobot {};
|
||||
let mut bot = Imp::spawn(behaviour, PASSWORD.to_string(), BOT_HOME.to_string());
|
||||
let mut bot = Imp::spawn(behaviour,String::new(), BOT_HOME.to_string());
|
||||
bot.event_loop::<Echobot>(echobot.borrow_mut());
|
||||
});
|
||||
event_loop_handle.join().expect("Error running event loop");
|
||||
|
|
Loading…
Reference in New Issue