pub struct Message<M = String, T = Value> {
pub jsonrpc: String,
pub method: Option<M>,
pub params: Option<T>,
pub result: Option<T>,
pub error: Option<MessageError>,
pub id: Id,
}
Fields§
§jsonrpc: String
§method: Option<M>
§params: Option<T>
§result: Option<T>
§error: Option<MessageError>
§id: Id
Implementations§
Source§impl<M: PartialEq + Serialize + DeserializeOwned, T: Serialize + DeserializeOwned> Message<M, T>
impl<M: PartialEq + Serialize + DeserializeOwned, T: Serialize + DeserializeOwned> Message<M, T>
Source§impl Message<String, Value>
impl Message<String, Value>
pub fn decrypt( cipher_text: &str, sym_key: [u8; 32], encoding: Option<EncodingType>, ) -> Result<Self>
pub fn try_decode<M, P>(&self) -> Result<Message<M, P>>
pub fn decode_result<R>(&self) -> Result<Message<String, R>>where
R: DeserializeOwned,
pub fn into_value(self) -> Result<Value>
Trait Implementations§
Source§impl<'de, M, T> Deserialize<'de> for Message<M, T>where
M: Deserialize<'de>,
T: Deserialize<'de>,
impl<'de, M, T> Deserialize<'de> for Message<M, T>where
M: Deserialize<'de>,
T: Deserialize<'de>,
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<M, T> StructuralPartialEq for Message<M, T>
Auto Trait Implementations§
impl<M = String, T = Value> !Freeze for Message<M, T>
impl<M, T> RefUnwindSafe for Message<M, T>where
M: RefUnwindSafe,
T: RefUnwindSafe,
impl<M, T> Send for Message<M, T>
impl<M, T> Sync for Message<M, T>
impl<M, T> Unpin for Message<M, T>
impl<M, T> UnwindSafe for Message<M, T>where
M: UnwindSafe,
T: UnwindSafe,
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