#[non_exhaustive]pub struct Arg {
pub channel: String,
pub inst_id: Option<String>,
pub inst_type: Option<String>,
pub inst_family: Option<String>,
pub extra: BTreeMap<String, String>,
}Expand description
A WebSocket channel argument used in subscribe/unsubscribe requests and returned in channel acknowledgements/data pushes.
Use Arg::new for a channel-only subscription, then add standard
instrument filters or custom channel parameters with consuming setters.
OKX docs: https://www.okx.com/docs-v5/en/#overview-websocket-subscribe
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.channel: StringOKX channel name, e.g. tickers, books5, account, or orders.
inst_id: Option<String>Instrument ID, e.g. BTC-USDT.
inst_type: Option<String>Instrument type, e.g. SPOT or SWAP.
inst_family: Option<String>Instrument family, e.g. BTC-USD.
extra: BTreeMap<String, String>Additional channel parameters not modeled as first-class fields.
Implementations§
Source§impl Arg
impl Arg
Sourcepub fn inst_family(self, inst_family: impl Into<String>) -> Self
pub fn inst_family(self, inst_family: impl Into<String>) -> Self
Set the instrument family.
Sourcepub fn param(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn param(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set an arbitrary channel parameter.
Sourcepub fn extra_param(self, update_interval: impl Into<String>) -> Self
pub fn extra_param(self, update_interval: impl Into<String>) -> Self
Set the extraParams parameter.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Arg
impl<'de> Deserialize<'de> for Arg
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Arg
impl StructuralPartialEq for Arg
Auto Trait Implementations§
impl Freeze for Arg
impl RefUnwindSafe for Arg
impl Send for Arg
impl Sync for Arg
impl Unpin for Arg
impl UnsafeUnpin for Arg
impl UnwindSafe for Arg
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