pub struct EventScanner<Mode = Unspecified, N: Network = Ethereum> { /* private fields */ }Expand description
An event scanner configured in mode Mode and bound to network N.
Create an instance via EventScannerBuilder, register
subscriptions with EventScanner::subscribe, then start the scanner with the mode-specific
start() method.
§Starting the scanner
All scanner modes follow the same general startup pattern:
- Register subscriptions first: call
EventScanner::subscribebefore starting the scanner withstart(). The scanner sends events only to subscriptions that have already been registered. - Non-blocking start:
start()returns immediately after spawning background tasks. Subscription streams yield events asynchronously. - Errors after startup: most runtime failures are delivered through subscription streams as
ScannerErroritems, rather than being returned fromstart().
Implementations§
Source§impl<N: Network> EventScanner<Historic, N>
impl<N: Network> EventScanner<Historic, N>
Sourcepub async fn start(self) -> Result<StartProof, ScannerError>
pub async fn start(self) -> Result<StartProof, ScannerError>
Starts the scanner in Historic mode.
See EventScanner for general startup notes.
§Errors
ScannerError::Timeout- if an RPC call required for startup times out.ScannerError::RpcError- if an RPC call required for startup fails.ScannerError::BlockNotFound- iffrom_blockorto_blockcannot be resolved.
Source§impl<N: Network> EventScanner<LatestEvents, N>
impl<N: Network> EventScanner<LatestEvents, N>
Sourcepub async fn start(self) -> Result<StartProof, ScannerError>
pub async fn start(self) -> Result<StartProof, ScannerError>
Starts the scanner in LatestEvents mode.
See EventScanner for general startup notes.
§Errors
ScannerError::Timeout- if an RPC call required for startup times out.ScannerError::RpcError- if an RPC call required for startup fails.ScannerError::BlockNotFound- iffrom_blockorto_blockcannot be resolved.
Source§impl<N: Network> EventScanner<Live, N>
impl<N: Network> EventScanner<Live, N>
Sourcepub async fn start(self) -> Result<StartProof, ScannerError>
pub async fn start(self) -> Result<StartProof, ScannerError>
Starts the scanner in Live mode.
See EventScanner for general startup notes.
§Errors
ScannerError::Timeout- if an RPC call required for startup times out.ScannerError::RpcError- if an RPC call required for startup fails.
Source§impl<N: Network> EventScanner<SyncFromBlock, N>
impl<N: Network> EventScanner<SyncFromBlock, N>
Sourcepub async fn start(self) -> Result<StartProof, ScannerError>
pub async fn start(self) -> Result<StartProof, ScannerError>
Starts the scanner in SyncFromBlock mode.
See EventScanner for general startup notes.
§Errors
ScannerError::Timeout- if an RPC call required for startup times out.ScannerError::RpcError- if an RPC call required for startup fails.ScannerError::BlockNotFound- iffrom_blockcannot be resolved.
Source§impl<N: Network> EventScanner<SyncFromLatestEvents, N>
impl<N: Network> EventScanner<SyncFromLatestEvents, N>
Sourcepub async fn start(self) -> Result<StartProof, ScannerError>
pub async fn start(self) -> Result<StartProof, ScannerError>
Starts the scanner in SyncFromLatestEvents mode.
See EventScanner for general startup notes.
§Errors
ScannerError::Timeout- if an RPC call required for startup times out.ScannerError::RpcError- if an RPC call required for startup fails.
Source§impl<Mode, N: Network> EventScanner<Mode, N>
impl<Mode, N: Network> EventScanner<Mode, N>
pub fn new(config: Mode, block_range_scanner: BlockRangeScanner<N>) -> Self
Source§impl<Mode, N: Network> EventScanner<Mode, N>
impl<Mode, N: Network> EventScanner<Mode, N>
Sourcepub fn buffer_capacity(&self) -> usize
pub fn buffer_capacity(&self) -> usize
Returns the configured stream buffer capacity.
Sourcepub fn subscribe(&mut self, filter: EventFilter) -> EventSubscription
pub fn subscribe(&mut self, filter: EventFilter) -> EventSubscription
Registers an event subscription.
Each call creates a separate subscription with its own buffer.
§Ordering
Ordering is guaranteed only within a single returned subscription. There is no ordering guarantee across subscriptions created by multiple calls to this method.
Trait Implementations§
Auto Trait Implementations§
impl<Mode, N> Freeze for EventScanner<Mode, N>where
Mode: Freeze,
impl<Mode = Unspecified, N = Ethereum> !RefUnwindSafe for EventScanner<Mode, N>
impl<Mode, N> Send for EventScanner<Mode, N>where
Mode: Send,
impl<Mode, N> Sync for EventScanner<Mode, N>where
Mode: Sync,
impl<Mode, N> Unpin for EventScanner<Mode, N>where
Mode: Unpin,
impl<Mode, N> UnsafeUnpin for EventScanner<Mode, N>where
Mode: UnsafeUnpin,
impl<Mode = Unspecified, N = Ethereum> !UnwindSafe for EventScanner<Mode, N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more