pub struct Msg { /* private fields */ }Implementations§
Source§impl Msg
impl Msg
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new message object, with an unset topic.
Note that a message object without a topic is invalid. set_topic must
be called to set a topic to make the message object valid.
Sourcepub fn get_params(&self) -> &HashMap<String, String>
pub fn get_params(&self) -> &HashMap<String, String>
Get a reference to the internal HashMap.
Sourcepub fn set_topic(&mut self, topic: &str) -> Result<(), Error>
pub fn set_topic(&mut self, topic: &str) -> Result<(), Error>
Set topic for message.
Overwrites current topic is one has already been set.
Sourcepub fn get_topic(&self) -> Option<&str>
pub fn get_topic(&self) -> Option<&str>
Get a reference to the topic string, or None if topic is not been set.
Sourcepub fn add_param<T: ToString, U: ToString>(&mut self, key: T, value: U)
pub fn add_param<T: ToString, U: ToString>(&mut self, key: T, value: U)
Add a parameter to the message.
Sourcepub fn add_str<T: ToString, U: ToString>(&mut self, key: T, value: U)
pub fn add_str<T: ToString, U: ToString>(&mut self, key: T, value: U)
Add a string parameter to the message.
pub fn get_param(&self, key: &str) -> Option<&str>
pub fn get_str(&self, key: &str) -> Option<&str>
pub fn get_int<T: FromStr>(&self, key: &str) -> Result<T, Error>
pub fn serialize(&self) -> Result<Vec<u8>, Error>
pub fn clear(&mut self)
Sourcepub fn into_params(self) -> HashMap<String, String>
pub fn into_params(self) -> HashMap<String, String>
Consume the Msg buffer and return the internal parameters HashMap.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Msg
impl RefUnwindSafe for Msg
impl Send for Msg
impl Sync for Msg
impl Unpin for Msg
impl UnsafeUnpin for Msg
impl UnwindSafe for Msg
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