#[non_exhaustive]pub struct EventStreamRequest {
pub since: Option<DateTime<Utc>>,
pub until: Option<DateTime<Utc>>,
pub since_id: Option<String>,
pub until_id: Option<String>,
}_sse only.Expand description
The window an event stream replays before going live.
Not interchangeable with the broker’s
broker::GetEventsRequest, and the difference
is not cosmetic: the five older streams bound their window by date, while
every stream found in the reference sweep — admin actions, IPO events, system
events, account activities, corporate actions — bounds it by timestamp. Sending a bare date to a route that parses RFC-3339 is how a
filter silently stops filtering.
The cursor pair is a ULID, and since_id
here means the ULID everywhere it is accepted — unlike the v1 broker
streams, where that name belongs to a deprecated integer form.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.since: Option<DateTime<Utc>>Replay events emitted at or after this time.
until: Option<DateTime<Utc>>Close the connection after the last event at or before this time.
Alpaca requires since whenever this is set, and rejects a future value.
since_id: Option<String>Replay events from this ULID onwards.
Whether the event with this id is itself redelivered depends on the
stream, and Alpaca’s reference states it both ways: the
corporate-actions stream documents it as inclusive, while the IPO-events
stream says “the first event returned will be the one immediately after
since_id”. One filter type serves every stream, so this cannot promise
either.
Treat the first event after a resume as possibly-duplicate and
deduplicate on id: that is correct under both readings, where assuming
exclusivity drops an event on every reconnect if the stream turns out to
be inclusive.
Mutually exclusive with since.
until_id: Option<String>Close the connection once this ULID has been delivered, inclusive.
Implementations§
Source§impl EventStreamRequest
impl EventStreamRequest
Sourcepub fn from_id(since_id: impl Into<String>) -> Self
pub fn from_id(since_id: impl Into<String>) -> Self
Events from this ULID onwards, which is how a dropped stream is resumed.
Named from_id rather than after_id because “after” asserts an
exclusivity that only some of these streams have — see
EventStreamRequest::since_id, and deduplicate on id.
Trait Implementations§
Source§impl Clone for EventStreamRequest
impl Clone for EventStreamRequest
Source§impl Debug for EventStreamRequest
impl Debug for EventStreamRequest
Source§impl Default for EventStreamRequest
impl Default for EventStreamRequest
Source§impl<'de> Deserialize<'de> for EventStreamRequest
impl<'de> Deserialize<'de> for EventStreamRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EventStreamRequest
Source§impl PartialEq for EventStreamRequest
impl PartialEq for EventStreamRequest
Source§impl Serialize for EventStreamRequest
impl Serialize for EventStreamRequest
impl StructuralPartialEq for EventStreamRequest
Auto Trait Implementations§
impl Freeze for EventStreamRequest
impl RefUnwindSafe for EventStreamRequest
impl Send for EventStreamRequest
impl Sync for EventStreamRequest
impl Unpin for EventStreamRequest
impl UnsafeUnpin for EventStreamRequest
impl UnwindSafe for EventStreamRequest
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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