once

Function once 

Source
pub fn once<T>(value: T) -> impl Stream<Item = Result<T, AnyError>>
Expand description

Create a stream of Result<T, AnyError> that yields one value and ends.

ยงExample


let mut stream = once(42);
assert_eq!(stream.next().await, Some(Ok(42)));
assert_eq!(stream.next().await, None);