[−][src]Trait nash_protocol::protocol::NashProtocolSubscription
Trait that defines subscriptions over the Nash protocol. The main difference is that
the transformation of response data to SubscriptionResponse must occur on every
incoming subscription event. Similarly, the subscription is able to modify client state
on every incoming event. This last property is important for a subscription that updates
asset nonces once that is available on the backend.
Associated Types
type SubscriptionResponse: Send + Sync[src]
Required methods
#[must_use]pub fn graphql<'life0, 'async_trait>(
&'life0 self,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Convert the protocol request to GraphQL from communication with Nash server
#[must_use]pub fn subscription_response_from_json<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Convert JSON response from incoming subscription data into protocol's associated type
#[must_use]pub fn wrap_response_as_any_subscription<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Provided methods
#[must_use]pub fn process_subscription_response<'life0, 'life1, 'async_trait>(
&'life0 self,
_response: &'life1 Self::SubscriptionResponse,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait, [src]
&'life0 self,
_response: &'life1 Self::SubscriptionResponse,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Update state based on data from incoming subscription response
Implementors
impl NashProtocolSubscription for SubscriptionRequest[src]
type SubscriptionResponse = SubscriptionResponse
pub fn graphql<'life0, 'async_trait>(
&'life0 self,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn subscription_response_from_json<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn wrap_response_as_any_subscription<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl NashProtocolSubscription for SubscribeTrades[src]
type SubscriptionResponse = TradesResponse
pub fn graphql<'life0, 'async_trait>(
&'life0 self,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn subscription_response_from_json<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn wrap_response_as_any_subscription<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
impl NashProtocolSubscription for SubscribeOrderbook[src]
type SubscriptionResponse = SubscribeOrderbookResponse
pub fn graphql<'life0, 'async_trait>(
&'life0 self,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
_state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn subscription_response_from_json<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<Self::SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
pub fn wrap_response_as_any_subscription<'life0, 'async_trait>(
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
response: Value,
state: Arc<Mutex<State>>
) -> Pin<Box<dyn Future<Output = Result<ResponseOrError<SubscriptionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,