method stream.seek
Continues at offset n before the first pull: a @resumable rpc stream restarts its call there (ctx.resumeFrom),
any other stream drops its first n elements.
Example:
fn numbers() -> stream<i64> {
yield 10
yield 20
yield 30
}
fn main() io {
var s = numbers()
s.seek(2)
match s.pull() {
Pulled.Item(v) => print("{v}")
_ => print("nothing")
}
}Output
30
pub(api) var fn seek(n: u64)Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
n | u64 |
Effects
none declared (pure unless the body says otherwise)
Defined in: std/core/stream.oxl:188