Skip to main content

Coupon

Struct Coupon 

Source
pub struct Coupon {
Show 32 fields pub card_id: String, pub card_type: String, pub title: String, pub title_sec: String, pub description: String, pub detail: String, pub card_status: CouponStatus, pub card_status_raw: Option<i32>, pub start_time: Option<OffsetDateTime>, pub end_time: Option<OffsetDateTime>, pub no_expiry: bool, pub activate_time: Option<OffsetDateTime>, pub amount: Option<Decimal>, pub currency: String, pub available_trade_session: String, pub trade_sessions: Vec<String>, pub subscription_id: String, pub ai_benefit: Option<CouponAiBenefit>, pub cash: Option<CouponCash>, pub coffee_coupon: Option<CouponCoffee>, pub commission: Option<CouponCommission>, pub crypto: Option<CouponCrypto>, pub finance_interest: Option<CouponFinanceInterest>, pub fund_deduct: Option<CouponFundDeduct>, pub fundamental: Option<CouponQuote>, pub ipo: Option<CouponIpo>, pub ipo_commission: Option<CouponIpoCommission>, pub ipo_interest: Option<CouponIpoInterest>, pub platform_fee_deduct: Option<CouponPlatformFeeDeduct>, pub quote: Option<CouponQuote>, pub stock: Option<CouponStock>, pub stock_fragment: Option<CouponStockFragment>,
}
Expand description

A coupon (reward card)

The type-specific terms are in the field named after the coupon type (commission, quote, stock, …); the fields of other types are None. App styling (cover, background, …) and the server’s deprecated top-level duplicates of the commission terms are not modelled, nor is the fund_interest object, which the server does not describe.

Fields§

§card_id: String

Coupon ID (32 hex characters; pass to crate::AssetContext::coupon_orders)

§card_type: String

Coupon type, e.g. commission, platform_fee_deduct, stock, quote, cash

§title: String

Title

§title_sec: String

Secondary title

§description: String

Description

§detail: String

Terms and details

§card_status: CouponStatus

Status

§card_status_raw: Option<i32>

The server’s numeric code of card_status, also when it is a code this SDK does not know (card_status is then Unknown); None when the value is missing or is not a code

§start_time: Option<OffsetDateTime>

Start of validity

§end_time: Option<OffsetDateTime>

End of validity (None when not set or when the coupon never expires; see Self::no_expiry)

§no_expiry: bool

Whether the coupon never expires (the server’s end time is in or after 2100)

§activate_time: Option<OffsetDateTime>

Activation time (None when not activated)

§amount: Option<Decimal>

Amount

§currency: String

Currency

§available_trade_session: String

Trading sessions the coupon applies to, as display text

§trade_sessions: Vec<String>

Trading sessions the coupon applies to, as returned by the server

§subscription_id: String

Subscription ID, as returned by the server

§ai_benefit: Option<CouponAiBenefit>

Terms of an AI benefit coupon

§cash: Option<CouponCash>

Terms of a cash coupon

§coffee_coupon: Option<CouponCoffee>

Terms of a coffee coupon

§commission: Option<CouponCommission>

Terms of a commission coupon

§crypto: Option<CouponCrypto>

Terms of a crypto coupon

§finance_interest: Option<CouponFinanceInterest>

Terms of a finance interest coupon

§fund_deduct: Option<CouponFundDeduct>

Terms of a fund deduction coupon

§fundamental: Option<CouponQuote>

Terms of a fundamental-data coupon

§ipo: Option<CouponIpo>

Terms of an IPO coupon

§ipo_commission: Option<CouponIpoCommission>

Terms of an IPO commission coupon

§ipo_interest: Option<CouponIpoInterest>

Terms of an IPO interest coupon

§platform_fee_deduct: Option<CouponPlatformFeeDeduct>

Terms of a platform fee deduction coupon

§quote: Option<CouponQuote>

Terms of a quote (market data) coupon

§stock: Option<CouponStock>

Terms of a stock coupon

§stock_fragment: Option<CouponStockFragment>

Terms of a stock fragment coupon

Implementations§

Source§

impl Coupon

Source

pub fn serialize<__S>( __self: &Coupon, __serializer: __S, ) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Source§

impl<'de> Coupon
where Coupon: Default,

Source

pub fn deserialize<__D>(__deserializer: __D) -> Result<Coupon, __D::Error>
where __D: Deserializer<'de>,

Trait Implementations§

Source§

impl Clone for Coupon

Source§

fn clone(&self) -> Self

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 Debug for Coupon

Source§

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

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

impl Default for Coupon

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Coupon

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Coupon

Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more