[−][src]Struct libevent::Base
Wrapper for libevent's event_base
which is responsible for executing
associated events.
Implementations
impl Base
[src]
The handle that abstracts over libevent's API in Rust.
pub fn new() -> Result<Self, Error>
[src]
Creates a new instance of Base
.
pub unsafe fn from_raw(base: NonNull<event_base>) -> Self
[src]
Creates a new instance of Base
using a raw, non-null event_base
pointer.
Safety
This function expects a non-null pointer, and thus does no such checks
internally. Thus the caller is responsible for checking the
event_base
validity.
pub unsafe fn as_raw(&self) -> NonNull<event_base>
[src]
Exposes the raw, non-null event_base
pointer.
Safety
This function returns a valid, non-null event_base
pointer which by
itself is safe. However, this function serves as an escape hatch to do
unsafe things.
pub fn loop_(&self, flags: LoopFlags) -> ExitReason
[src]
Wrapper for libevent's event_base_loop
, which runs the event loop in
a manner defined by the LoopFlags
input.
pub fn loopexit(&self, timeout: Duration) -> i32
[src]
Wrapper for libevent's event_base_loopexit
, which tells the running
event loop to exit after a specified Duration
.
pub fn loopbreak(&self) -> i32
[src]
Wrapper for libevent's event_base_loopbreak
, which tells the running
event loop to break immediately.
pub fn loopcontinue(&self) -> i32
[src]
Wrapper for libevent's event_base_loopcontinue
, which tells the
running event loop to resume searching for active events.
pub fn event_new(
&mut self,
fd: Option<EvutilSocket>,
flags: EventFlags,
callback: extern "C" fn(_: EvutilSocket, _: EventCallbackFlags, _: EventCallbackCtx),
callback_ctx: Option<EventCallbackCtx>
) -> Option<NonNull<event>>
[src]
&mut self,
fd: Option<EvutilSocket>,
flags: EventFlags,
callback: extern "C" fn(_: EvutilSocket, _: EventCallbackFlags, _: EventCallbackCtx),
callback_ctx: Option<EventCallbackCtx>
) -> Option<NonNull<event>>
Wrapper for libevent's event_new
, which allocates and initializes a
new event
with the given parameters.
pub fn event_assign(
&mut self,
ev: NonNull<event>,
fd: Option<EvutilSocket>,
flags: EventFlags,
callback: extern "C" fn(_: EvutilSocket, _: EventCallbackFlags, _: EventCallbackCtx),
callback_ctx: Option<EventCallbackCtx>
) -> c_int
[src]
&mut self,
ev: NonNull<event>,
fd: Option<EvutilSocket>,
flags: EventFlags,
callback: extern "C" fn(_: EvutilSocket, _: EventCallbackFlags, _: EventCallbackCtx),
callback_ctx: Option<EventCallbackCtx>
) -> c_int
Wrapper for libevent's event_new
, which initializes a pre-allocated
event
with the given parameters.
pub fn event_add(
&self,
event: NonNull<event>,
timeout: Option<Duration>
) -> c_int
[src]
&self,
event: NonNull<event>,
timeout: Option<Duration>
) -> c_int
Wrapper for libevent's event_add
, which activates an initialized
event
for a pre-defined Base
and a given timeout interval.
impl Base
[src]
pub fn spawn<T: Exec<Internal<T>, F>, F>(
&mut self,
ev: Event<Inactive<T>>,
cb: F
) -> Result<()>
[src]
&mut self,
ev: Event<Inactive<T>>,
cb: F
) -> Result<()>
Activates a given inactive Event
with no handle sharing.
Control of the event via the Event
handle is relegated only from
within the closure F
, which means that no synchronization wrappers
are required for operation.
pub fn spawn_local<T: Exec<LocalWeak<T>, F>, F>(
&mut self,
ev: Event<Inactive<T>>,
cb: F
) -> Result<Event<Local<T>>>
[src]
&mut self,
ev: Event<Inactive<T>>,
cb: F
) -> Result<Event<Local<T>>>
Activates a given inactive Event
with thread-local sharing.
Control of the event via the Event
handle is shared between the
closure F
as well as the returned Event
, which internally uses an
Rc<RefCell>
.
impl Base
[src]
pub fn turn(&self) -> ExitReason
[src]
Turns the libevent base once.
pub fn run_timeout(&self, timeout: Duration) -> ExitReason
[src]
Turns the libevent base until exit or timeout duration reached.
pub fn run_until_event(&self, timeout: Option<Duration>) -> ExitReason
[src]
Turns the libevent base until next active event.
pub fn run(&self) -> ExitReason
[src]
Turns the libevent base until exit.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,