1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-12-01 02:44:37 +01:00

add handle method to contexts

This commit is contained in:
Nikolay Kim 2018-01-28 09:47:46 -08:00
parent f3cce6a04c
commit 456fd1364a
2 changed files with 14 additions and 0 deletions

View File

@ -167,6 +167,13 @@ impl<A, S> HttpContext<A, S> where A: Actor<Context=Self> {
}
self.stream.as_mut().map(|s| s.push(frame));
}
/// Handle of the running future
///
/// SpawnHandle is the handle returned by `AsyncContext::spawn()` method.
pub fn handle(&self) -> SpawnHandle {
self.inner.curr_handle()
}
}
impl<A, S> ActorHttpContext for HttpContext<A, S> where A: Actor<Context=Self>, S: 'static {

View File

@ -191,6 +191,13 @@ impl<A, S> WebsocketContext<A, S> where A: Actor<Context=Self> {
}
self.stream.as_mut().map(|s| s.push(frame));
}
/// Handle of the running future
///
/// SpawnHandle is the handle returned by `AsyncContext::spawn()` method.
pub fn handle(&self) -> SpawnHandle {
self.inner.curr_handle()
}
}
impl<A, S> ActorHttpContext for WebsocketContext<A, S> where A: Actor<Context=Self>, S: 'static {