[−][src]Struct tokio_core::reactor::Remote
Handle to an event loop, used to construct I/O objects, send messages, and otherwise interact indirectly with the event loop itself.
Handles can be cloned, and when cloned they will still refer to the same underlying event loop.
Methods
impl Remote
[src]
impl Remote
pub fn spawn<F, R>(&self, f: F) where
F: FnOnce(&Handle) -> R + Send + 'static,
R: IntoFuture<Item = (), Error = ()>,
R::Future: 'static,
[src]
pub fn spawn<F, R>(&self, f: F) where
F: FnOnce(&Handle) -> R + Send + 'static,
R: IntoFuture<Item = (), Error = ()>,
R::Future: 'static,
Spawns a new future into the event loop this remote is associated with.
This function takes a closure which is executed within the context of the I/O loop itself. The future returned by the closure will be scheduled on the event loop and run to completion.
Note that while the closure, F
, requires the Send
bound as it might
cross threads, the future R
does not.
Panics
This method will not catch panics from polling the future f
. If
the future panics then it's the responsibility of the caller to catch
that panic and handle it as appropriate.
pub fn id(&self) -> CoreId
[src]
pub fn id(&self) -> CoreId
Return the ID of the represented Core
pub fn handle(&self) -> Option<Handle>
[src]
pub fn handle(&self) -> Option<Handle>
Attempts to "promote" this remote to a handle, if possible.
This function is intended for structures which typically work through a
Remote
but want to optimize runtime when the remote doesn't actually
leave the thread of the original reactor. This will attempt to return a
handle if the Remote
is on the same thread as the event loop and the
event loop is running.
If this Remote
has moved to a different thread or if the event loop is
running, then None
may be returned. If you need to guarantee access to
a Handle
, then you can call this function and fall back to using
spawn
above if it returns None
.
Trait Implementations
impl Clone for Remote
[src]
impl Clone for Remote
fn clone(&self) -> Remote
[src]
fn clone(&self) -> Remote
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Remote
[src]
impl Debug for Remote
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<F> Executor<F> for Remote where
F: Future<Item = (), Error = ()> + Send + 'static,
[src]
impl<F> Executor<F> for Remote where
F: Future<Item = (), Error = ()> + Send + 'static,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Erased for T
[src]
impl<T> Erased for T