search for: borrow_mut

Displaying 2 results from an estimated 2 matches for "borrow_mut".

2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
...+ +use std::cell::RefCell; +use std::rc::Rc; + +#[test] +fn close_event() { + let close_invoked = Rc::new(RefCell::new(0)); + { + let mut g = guestfs::Handle::create().expect("create"); + g.set_event_callback( + |_, _, _, _| { + *close_invoked.borrow_mut() += 1; + }, + &[guestfs::Event::Close], + ) + .unwrap(); + assert_eq!(*close_invoked.borrow(), 0); + } + assert_eq!(*close_invoked.borrow(), 1); +} diff --git a/rust/tests/420_log_messages.rs b/rust/tests/420_log_messages.rs new file mode 100644...
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
I fixed based on comments. I'll send these two patches to this mailing list. - Fix Handle -> Handle<'a> - Add events Regards, Hiroyuki 2019年8月1日(木) 0:01 Pino Toscano <ptoscano@redhat.com>: > Hi Hiroyuki, > > On Tuesday, 30 July 2019 07:51:37 CEST Hiroyuki Katsura wrote: > > This patch includes: > > > > - Event callback handlers > > -