pub struct Operation { /* private fields */ }Expand description
A single-consumer event subscription. Native callbacks never run application code.
Implementations§
Source§impl Operation
impl Operation
pub fn cancellation(&self) -> Cancellation
pub fn next_event(&mut self) -> Next<'_> ⓘ
Sourcepub fn recv_timeout(&mut self, timeout: Duration) -> Option<Event>
pub fn recv_timeout(&mut self, timeout: Duration) -> Option<Event>
Examples found in repository?
examples/day_part_zeroconf.rs (line 9)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let kind = std::env::args().nth(1);
5 let options = kind.map_or_else(BrowseOptions::all, BrowseOptions::service);
6 let mut browser = browse(options)?;
7 let until = Instant::now() + Duration::from_secs(10);
8 while Instant::now() < until {
9 if let Some(e) = browser.recv_timeout(Duration::from_millis(250)) {
10 println!("{e:?}");
11 if matches!(e, Event::Error(_)) {
12 break;
13 }
14 }
15 }
16 browser.stop();
17 Ok(())
18}Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Examples found in repository?
examples/day_part_zeroconf.rs (line 16)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let kind = std::env::args().nth(1);
5 let options = kind.map_or_else(BrowseOptions::all, BrowseOptions::service);
6 let mut browser = browse(options)?;
7 let until = Instant::now() + Duration::from_secs(10);
8 while Instant::now() < until {
9 if let Some(e) = browser.recv_timeout(Duration::from_millis(250)) {
10 println!("{e:?}");
11 if matches!(e, Event::Error(_)) {
12 break;
13 }
14 }
15 }
16 browser.stop();
17 Ok(())
18}Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Operation
impl !UnwindSafe for Operation
impl Freeze for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more