Struct tor_events::EventReactor
source · [−]pub struct EventReactor { /* private fields */ }
Expand description
A reactor used to forward events to make the event reporting system work.
Note
Currently, this type is a singleton; there is one event reporting system used for the entire program. This is not stable, and may change in future.
Implementations
sourceimpl EventReactor
impl EventReactor
sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Initialize the event reporting system, returning a reactor that must be run for it to work,
and a TorEventReceiver
that can be used to extract events from the system. If the system
has already been initialized, returns None
instead of a reactor.
Warnings
The returned reactor must be run with EventReactor::run
, in a background async task.
If it is not, the event system might consume unbounded amounts of memory.
sourcepub fn receiver() -> Option<TorEventReceiver>
pub fn receiver() -> Option<TorEventReceiver>
Get a TorEventReceiver
to receive events from, assuming an EventReactor
is already
running somewhere. (If it isn’t, returns None
.)
As noted in the type-level documentation, this function might not always work this way.
Auto Trait Implementations
impl !RefUnwindSafe for EventReactor
impl Send for EventReactor
impl Sync for EventReactor
impl Unpin for EventReactor
impl !UnwindSafe for EventReactor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more