Skip to main content

WebSocketFactory

Struct WebSocketFactory 

Source
pub struct WebSocketFactory<S = Unset> { /* private fields */ }
Expand description

Factory that derives stock + futopt WebSocket endpoint configurations from a single authentication credential and an optional shared base URL.

The factory is generic over a typestate marker (Unset / WithAuth) so the compiler enforces that .auth(...) is called before .stock() / .futopt().

Implementations§

Source§

impl WebSocketFactory

Source

pub fn new() -> WebSocketFactory

Create a fresh factory pointing at the production WebSocket base URL (crate::urls::WS_BASE_ROOT). Returns a typestate-Unset instance; chain auth before stock / futopt.

Source

pub fn auth(self, auth: AuthRequest) -> WebSocketFactory<WithAuth>

Set the authentication credential, advancing the typestate to WithAuth.

Source§

impl<S> WebSocketFactory<S>

Source

pub fn base_url(self, base: impl Into<String>) -> WebSocketFactory<S>

Override the WebSocket base URL.

Available in any state. base MUST include the API version segment (e.g. "wss://api.fugle.tw/marketdata/v1.0"). The factory appends only /{stock|futopt}/streaming to whatever you pass; it does NOT inject /{API_VERSION} for caller-supplied bases. Trailing slashes are stripped.

§⚠️ Silent breaking change in 0.6.0

Pre-0.6.0 this method accepted a host root (no version) and the factory silently appended /{API_VERSION}. As of 0.6.0 the caller owns the full prefix, matching the OpenAI / Stripe / AWS SDK convention. Code that worked in 0.5.x will compile against 0.6.0 but produce a 404 on first connect because the URL lacks the /v1.0 segment. See MIGRATION-0.6.md.

Source§

impl WebSocketFactory<WithAuth>

Source

pub fn stock(&self) -> ConnectionConfigBuilder

Derived stock-streaming endpoint as a ConnectionConfigBuilder.

Chain further setters (.message_buffer(...), etc.) then .build() to obtain the ConnectionConfig. Only available once auth(...) has been called.

Source

pub fn futopt(&self) -> ConnectionConfigBuilder

Derived futures/options streaming endpoint as a ConnectionConfigBuilder. Only available once auth(...) has been called.

Trait Implementations§

Source§

impl<S> Clone for WebSocketFactory<S>
where S: Clone,

Source§

fn clone(&self) -> WebSocketFactory<S>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<S> Debug for WebSocketFactory<S>
where S: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for WebSocketFactory

Source§

fn default() -> WebSocketFactory

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S> Freeze for WebSocketFactory<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for WebSocketFactory<S>
where S: RefUnwindSafe,

§

impl<S> Send for WebSocketFactory<S>
where S: Send,

§

impl<S> Sync for WebSocketFactory<S>
where S: Sync,

§

impl<S> Unpin for WebSocketFactory<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for WebSocketFactory<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for WebSocketFactory<S>
where S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V