pub struct Answer {
pub publish: Vec<Publish>,
pub protocol: Vec<Protocol>,
pub log: Vec<LogLine>,
pub extra: Map<String, Value>,
}Expand description
The answer to one event. Every part is optional; extra carries a kind’s
own members (a carrier driver’s).
Fields§
§publish: Vec<Publish>§protocol: Vec<Protocol>§log: Vec<LogLine>§extra: Map<String, Value>Implementations§
Source§impl Answer
impl Answer
Sourcepub fn publish(
&mut self,
topic: impl Into<String>,
payload: impl AsRef<[u8]>,
) -> &mut Self
pub fn publish( &mut self, topic: impl Into<String>, payload: impl AsRef<[u8]>, ) -> &mut Self
Publish payload on a vendor topic.
Sourcepub fn publish_json(
&mut self,
topic: impl Into<String>,
value: &Value,
) -> &mut Self
pub fn publish_json( &mut self, topic: impl Into<String>, value: &Value, ) -> &mut Self
Publish a JSON value on a vendor topic.
Sourcepub fn protocol(
&mut self,
adapter: impl Into<String>,
key: impl Into<String>,
kind: &str,
body: Value,
) -> &mut Self
pub fn protocol( &mut self, adapter: impl Into<String>, key: impl Into<String>, kind: &str, body: Value, ) -> &mut Self
A protocol v1 message for key behind adapter.
Sourcepub fn result(
&mut self,
adapter: &str,
key: &str,
result: CmdResult,
) -> &mut Self
pub fn result( &mut self, adapter: &str, key: &str, result: CmdResult, ) -> &mut Self
The answer to an intent: cmd/res with its id and status.
pub fn log_debug(&mut self, m: impl Into<String>) -> &mut Self
pub fn log_info(&mut self, m: impl Into<String>) -> &mut Self
pub fn log_warning(&mut self, m: impl Into<String>) -> &mut Self
pub fn log_error(&mut self, m: impl Into<String>) -> &mut Self
Trait Implementations§
impl StructuralPartialEq for Answer
Auto Trait Implementations§
impl Forget for Answer
impl Freeze for Answer
impl Move for Answer
impl RefUnwindSafe for Answer
impl Send for Answer
impl Sync for Answer
impl Unpin for Answer
impl UnsafeUnpin for Answer
impl UnwindSafe for Answer
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