1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-03 15:39:50 +00: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 {