Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FinalizedStream documentation #203

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2781,13 +2781,14 @@ impl Drop for FinalizedBlocksStream {
}

impl FinalizedBlocksStream {
/// Get the next finalized block in the stream. Or [`None`] if the there are
/// no more. This function blocks until a finalized block becomes available,
/// so in general it is a good idea to c
/// Retrieves the next finalized block from the stream. This function will
/// block until a finalized block becomes available. To avoid waiting
/// indefinitely, consider using [`FinalizedBlocksStream::next_timeout`]
/// instead. If the channel is closed, the next element is `None`.
pub async fn next(&mut self) -> Option<FinalizedBlockInfo> { self.receiver.recv().await }

/// Like [`FinalizedBlocksStream::next`], but only waits at most the
/// specified duration.
/// Similar to [`FinalizedBlocksStream::next`], but with a maximum wait time
/// defined by the specified duration between each finalized block.
pub async fn next_timeout(
&mut self,
duration: std::time::Duration,
Expand Down