Make 'ws::Stream![]' mean 'ws::Stream!['static]'.

This is in line with the stream macros in Rocket core.
This commit is contained in:
Sergio Benitez 2023-03-31 08:34:45 -07:00
parent 1d2cc257dc
commit 847e87d5c9
2 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,7 @@ fn echo_manual<'r>(ws: ws::WebSocket) -> ws::Channel<'r> {
}
#[get("/echo")]
fn echo_stream<'r>(ws: ws::WebSocket) -> ws::Stream!['r] {
fn echo_stream(ws: ws::WebSocket) -> ws::Stream!['static] {
ws::stream! { ws =>
for await message in ws {
yield message?;

View File

@ -132,11 +132,12 @@ impl<'r, S> IoHandler for MessageStream<'r, S>
#[macro_export]
macro_rules! Stream {
() => (Stream!['static]);
($l:lifetime) => (
$crate::ws::MessageStream<$l, impl rocket::futures::Stream<
Item = $crate::ws::Result<$crate::ws::Message>
> + $l>
)
);
}
#[macro_export]