search for: events_to_bitmask

Displaying 6 results from an estimated 6 matches for "events_to_bitmask".

2019 Jul 30
0
Re: [PATCH] Rust bindings: Implement Event features
...fs_event_to_string(bitmask: u64) -> *const c_char; >+ fn free(buf: *const c_void); >+} >+ >+#[derive(Hash, PartialEq, Eq)] >+pub struct EventHandle { >+ eh: i32, >+} >+ >+pub type Callback = FnMut(guestfs::Event, EventHandle, &[i8], &[u64]); >+ >+fn events_to_bitmask(v: &[guestfs::Event]) -> u64 { >+ let mut r = 0u64; >+ for x in v.iter() { >+ r |= x.to_u64(); >+ } >+ r >+} >+ >+pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, error::Error> { >+ let bitmask = events_to_bitma...
2019 Jul 30
4
[PATCH] Rust bindings: Implement Event features
...nst base::guestfs_h, eh: i32); + fn guestfs_event_to_string(bitmask: u64) -> *const c_char; + fn free(buf: *const c_void); +} + +#[derive(Hash, PartialEq, Eq)] +pub struct EventHandle { + eh: i32, +} + +pub type Callback = FnMut(guestfs::Event, EventHandle, &[i8], &[u64]); + +fn events_to_bitmask(v: &[guestfs::Event]) -> u64 { + let mut r = 0u64; + for x in v.iter() { + r |= x.to_u64(); + } + r +} + +pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, error::Error> { + let bitmask = events_to_bitmask(events); + + let r = unsafe {...
2019 Jul 30
1
Re: [PATCH] Rust bindings: Implement Event features
...gt; >+ fn free(buf: *const c_void); > >+} > >+ > >+#[derive(Hash, PartialEq, Eq)] > >+pub struct EventHandle { > >+ eh: i32, > >+} > >+ > >+pub type Callback = FnMut(guestfs::Event, EventHandle, &[i8], &[u64]); > >+ > >+fn events_to_bitmask(v: &[guestfs::Event]) -> u64 { > >+ let mut r = 0u64; > >+ for x in v.iter() { > >+ r |= x.to_u64(); > >+ } > >+ r > >+} > >+ > >+pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, > error::Error...
2019 Aug 05
2
[PATCH 2/2] Rust bindings: Implement callback handlers
...que: *const c_void, + ) -> i32; + fn guestfs_delete_event_callback(g: *const base::guestfs_h, eh: i32); + fn guestfs_event_to_string(bitmask: u64) -> *const c_char; + fn free(buf: *const c_void); +} + #[derive(Hash, PartialEq, Eq)] pub struct EventHandle { eh: i32, } + +fn events_to_bitmask(v: &[guestfs::Event]) -> u64 { + let mut r = 0u64; + for x in v.iter() { + r |= x.to_u64(); + } + r +} + +pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, error::Error> { + let bitmask = events_to_bitmask(events); + + let r = unsafe {...
2019 Aug 05
3
Re: [PATCH] Rust bindings: Implement Event features
...Would it be possible to split the Handle -> Handle<'a> change in an own > small patch? This way it can be documented why it was changed. > > > +pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, > error::Error> { > > + let bitmask = events_to_bitmask(events); > > + > > + let r = unsafe { guestfs_event_to_string(bitmask) }; > > + if r.is_null() { > > + Err(error::unix_error("event_to_string")) > > + } else { > > + let s = unsafe { ffi::CStr::from_ptr(r) }; > > + le...
2019 Jul 31
0
Re: [PATCH] Rust bindings: Implement Event features
...ents(410-430) > --- Would it be possible to split the Handle -> Handle<'a> change in an own small patch? This way it can be documented why it was changed. > +pub fn event_to_string(events: &[guestfs::Event]) -> Result<String, error::Error> { > + let bitmask = events_to_bitmask(events); > + > + let r = unsafe { guestfs_event_to_string(bitmask) }; > + if r.is_null() { > + Err(error::unix_error("event_to_string")) > + } else { > + let s = unsafe { ffi::CStr::from_ptr(r) }; > + let s = s.to_str()?.to_string(); The...