pub struct TransportMessage {
pub pattern: String,
pub data: Value,
}Expand description
Adapter-neutral microservice transport message.
Fields§
§pattern: String§data: ValueImplementations§
Source§impl TransportMessage
impl TransportMessage
pub fn new(pattern: impl Into<String>, data: impl Into<Value>) -> Self
pub fn pattern(&self) -> &str
pub fn data(&self) -> &Value
pub fn text(pattern: impl Into<String>, data: impl Into<String>) -> Self
pub fn json<T>(pattern: impl Into<String>, data: &T) -> Result<Self>where
T: Serialize,
pub fn data_as<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn data_field(&self, name: &str) -> Result<Option<Value>>
pub fn data_field_as<T>(&self, name: &str) -> Result<T>where
T: DeserializeOwned,
pub fn optional_data_field_as<T>(&self, name: &str) -> Result<Option<T>>where
T: DeserializeOwned,
pub fn data_field_string(&self, name: &str) -> Result<String>
pub fn optional_data_field_string(&self, name: &str) -> Result<Option<String>>
pub fn validated_data<T>(&self) -> Result<T>where
T: DeserializeOwned + Validate,
Trait Implementations§
Source§impl Clone for TransportMessage
impl Clone for TransportMessage
Source§fn clone(&self) -> TransportMessage
fn clone(&self) -> TransportMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TransportMessage
impl Debug for TransportMessage
Source§impl<'de> Deserialize<'de> for TransportMessage
impl<'de> Deserialize<'de> for TransportMessage
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
Source§impl PartialEq for TransportMessage
impl PartialEq for TransportMessage
Source§impl Serialize for TransportMessage
impl Serialize for TransportMessage
impl StructuralPartialEq for TransportMessage
Auto Trait Implementations§
impl Freeze for TransportMessage
impl RefUnwindSafe for TransportMessage
impl Send for TransportMessage
impl Sync for TransportMessage
impl Unpin for TransportMessage
impl UnsafeUnpin for TransportMessage
impl UnwindSafe for TransportMessage
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