pub struct MessageKind {
pub version: u8,
pub request_id: Option<u64>,
pub trade_index: Option<i64>,
pub id: Option<Uuid>,
pub action: Action,
pub payload: Option<Payload>,
}
Expand description
Use this Message to establish communication between users and Mostro
Fields§
§version: u8
Message version
request_id: Option<u64>
Request_id for test on client
trade_index: Option<i64>
Trade key index
id: Option<Uuid>
Message id is not mandatory
action: Action
Action to be taken
payload: Option<Payload>
Payload of the Message
Implementations§
Source§impl MessageKind
impl MessageKind
Sourcepub fn new(
id: Option<Uuid>,
request_id: Option<u64>,
trade_index: Option<i64>,
action: Action,
payload: Option<Payload>,
) -> Self
pub fn new( id: Option<Uuid>, request_id: Option<u64>, trade_index: Option<i64>, action: Action, payload: Option<Payload>, ) -> Self
New message
Sourcepub fn from_json(json: &str) -> Result<Self, ServiceError>
pub fn from_json(json: &str) -> Result<Self, ServiceError>
Get message from json string
Sourcepub fn as_json(&self) -> Result<String, ServiceError>
pub fn as_json(&self) -> Result<String, ServiceError>
Get message as json string
pub fn get_action(&self) -> Action
Sourcepub fn get_next_trade_key(&self) -> Result<Option<(String, u32)>, ServiceError>
pub fn get_next_trade_key(&self) -> Result<Option<(String, u32)>, ServiceError>
Get the next trade keys when order is settled
pub fn get_rating(&self) -> Result<u8, ServiceError>
pub fn get_order(&self) -> Option<&SmallOrder>
pub fn get_payment_request(&self) -> Option<String>
pub fn get_amount(&self) -> Option<i64>
pub fn get_payload(&self) -> Option<&Payload>
pub fn has_trade_index(&self) -> (bool, i64)
pub fn trade_index(&self) -> i64
Trait Implementations§
Source§impl Clone for MessageKind
impl Clone for MessageKind
Source§fn clone(&self) -> MessageKind
fn clone(&self) -> MessageKind
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MessageKind
impl Debug for MessageKind
Source§impl<'de> Deserialize<'de> for MessageKind
impl<'de> Deserialize<'de> for MessageKind
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
Auto Trait Implementations§
impl Freeze for MessageKind
impl RefUnwindSafe for MessageKind
impl Send for MessageKind
impl Sync for MessageKind
impl Unpin for MessageKind
impl UnwindSafe for MessageKind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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