Struct wombo::Wombo [] [src]

pub struct Wombo<T: Send + 'static> { /* fields omitted */ }

A module for starting event loop threads with notifications when they exit, and with hooks for canceling any running futures.

Any cloned instances will refer to the same child thread and event loop.

Methods

impl<T: Send + 'static> Wombo<T>
[src]

[src]

Create a new Wombo instance without initializing the event loop thread.

[src]

Spawn a child thread running an event loop, running func on the child thread before the core is run.

To register a callback that should run when cancel is called, but before the event loop is interrupted, use on_cancel here.

Panics

Panics if Core::new() returns an error creating the event loop on the child thread.

[src]

Read the ID for this Wombo instance. This will not change if the backing thread exits or restarts.

[src]

Read the thread ID of the event loop thread.

[src]

Whether or not the event loop thread is running.

[src]

Send a message to cancel the event loop thread, interrupting any futures running there.

This first triggers the callback from on_cancel, if defined, then interrupts the event loop and causes the spawned thread to exit. A message is then emitted to the receiver returned by on_exit, and resets the state of this instance so spawn can be called again.

[src]

Returns a oneshot receiver that resolves when the thread exits for any reason, either via the cancel command, or otherwise.

Upon calling cancel if the caller has registered an on_cancel callback then the receiver returned here will resolve with Some data, otherwise it resolves with None if no on_cancel callback exists.

If the future returned by func in spawn resolves before cancel is called that data will be sent to the receiver returned here.

If this is called more than once the previous oneshot channel will be canceled.

Trait Implementations

impl<T: Clone + Send + 'static> Clone for Wombo<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Send + 'static> Debug for Wombo<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Send + 'static> PartialEq for Wombo<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<T: Send + 'static> Eq for Wombo<T>
[src]

impl<T: Send + 'static> Hash for Wombo<T>
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more