pub struct MarketFeed { /* private fields */ }Expand description
A filtered stream of decoded MarketEvents for a single perp.
Created via MarketFeed::subscribe(). Call next()
in a loop to receive events. Returns None when the WebSocket
connection is lost.
Implementations§
Source§impl MarketFeed
impl MarketFeed
Sourcepub async fn subscribe(
ws: &WsManager,
perp_manager: Address,
beacon: Address,
perp_id: B256,
) -> Result<Self>
pub async fn subscribe( ws: &WsManager, perp_manager: Address, beacon: Address, perp_id: B256, ) -> Result<Self>
Subscribe to events for a single perp.
Creates a WebSocket log subscription filtered to the perp_manager
and beacon contract addresses. PerpManager events are further
filtered by perp_id in next(). Beacon
IndexUpdated events are already scoped to this perp by the
beacon address filter.
Sourcepub async fn next(&mut self) -> Option<MarketEvent>
pub async fn next(&mut self) -> Option<MarketEvent>
Receive the next decoded event for this perp.
Blocks until a matching event arrives. Returns None when the
WebSocket connection is lost (sender dropped).
Skips unrecognized events and events belonging to other perps.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MarketFeed
impl RefUnwindSafe for MarketFeed
impl Send for MarketFeed
impl Sync for MarketFeed
impl Unpin for MarketFeed
impl UnsafeUnpin for MarketFeed
impl UnwindSafe for MarketFeed
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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