pub struct SubscribeRequest {
pub channel: String,
pub symbol: Option<String>,
pub symbols: Option<Vec<String>>,
pub after_hours: Option<bool>,
pub intraday_odd_lot: Option<bool>,
}Expand description
Subscription request for WebSocket
Modifier flags (after_hours, intraday_odd_lot) are preserved across
reconnection so a 盤後 or 盤中零股 subscription comes back as the same
session — previous design stored only {channel, symbol} which silently
downgraded on resubscribe.
On the wire either symbol (single) or symbols (batch) is populated,
never both — see Symbols. The two fields are encoded separately
because the Fugle server protocol uses the field presence to drive its
ACK shape (subscribed event data is an object for single, array for
batch).
Fields§
§channel: StringChannel to subscribe to
symbol: Option<String>Stock symbol for the single-symbol path. Mutually exclusive with
symbols. Both None is allowed for channel-only subscriptions
(e.g. indices) where the server doesn’t require a symbol.
symbols: Option<Vec<String>>Batch symbol list for the multi-symbol path. Mutually exclusive
with symbol. Serializes as symbols: [...] on the wire.
after_hours: Option<bool>FutOpt after-hours session flag. Sent as afterHours: true on wire
when set; absent otherwise so stock path serializes unchanged.
intraday_odd_lot: Option<bool>Stock intraday odd-lot flag. Sent as intradayOddLot: true on wire
when set; absent otherwise.
Implementations§
Source§impl SubscribeRequest
impl SubscribeRequest
Sourcepub fn builder() -> SubscribeRequestBuilder
pub fn builder() -> SubscribeRequestBuilder
Create an instance of SubscribeRequest using the builder syntax
Source§impl SubscribeRequest
impl SubscribeRequest
Sourcepub fn new(channel: Channel, symbol: impl Into<String>) -> Self
pub fn new(channel: Channel, symbol: impl Into<String>) -> Self
Create a new single-symbol subscription request.
For the polymorphic single/batch variant, use SubscribeRequest::with_symbols.
Sourcepub fn with_symbols(channel: Channel, symbols: impl Into<Symbols>) -> Self
pub fn with_symbols(channel: Channel, symbols: impl Into<Symbols>) -> Self
Create a subscription request from a Symbols.
Accepts &str / String / Vec<String> / array literal / slice via
impl Into<Symbols>. Routes to the symbol or symbols wire field
based on the variant.
The input runs through Symbols::normalized before being attached
to the request, so duplicate symbols collapse to one subscription
and whitespace-only differences are squashed. Empty inputs produce a
request with no symbols attached (the dispatch path treats this as
a no-op on the wire).
Sourcepub fn expand(self) -> Vec<SubscribeRequest>
pub fn expand(self) -> Vec<SubscribeRequest>
Expand a batch request into N single-symbol requests.
For wire transmission a batch SubscribeRequest is sent as a single
frame with symbols: [...], but for internal bookkeeping (and
reconnect replay) each symbol must occupy its own row in
SubscriptionManager so that the server’s per-symbol ACK can be
recorded against a stable local key. This helper materializes the
expansion; single-symbol requests pass through unchanged.
Modifier flags (after_hours, intraday_odd_lot) are duplicated to
every expanded entry — batches always share their modifier flags
across the symbols they enumerate.
Trait Implementations§
Source§impl Clone for SubscribeRequest
impl Clone for SubscribeRequest
Source§fn clone(&self) -> SubscribeRequest
fn clone(&self) -> SubscribeRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SubscribeRequest
impl Debug for SubscribeRequest
Source§impl Default for SubscribeRequest
impl Default for SubscribeRequest
Source§fn default() -> SubscribeRequest
fn default() -> SubscribeRequest
Source§impl<'de> Deserialize<'de> for SubscribeRequest
impl<'de> Deserialize<'de> for SubscribeRequest
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>,
Source§impl PartialEq for SubscribeRequest
impl PartialEq for SubscribeRequest
Source§fn eq(&self, other: &SubscribeRequest) -> bool
fn eq(&self, other: &SubscribeRequest) -> bool
self and other values to be equal, and is used by ==.