Fixup rust example

This commit is contained in:
Sarah Jamie Lewis 2023-04-27 12:12:07 -07:00
parent b45d2c1097
commit 9ca33e1a8b
1 changed files with 2 additions and 3 deletions

View File

@ -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");