pub struct MessageBuffer { /* fields omitted */ }
A raw message represented by the bytes buffer.
Creates MessageBuffer
instance from the bytes vector.
use exonum::messages::MessageBuffer;
let message_buffer = MessageBuffer::from_vec(vec![1, 2, 3]);
assert!(!message_buffer.is_empty());
Returns the length of the message in bytes.
use exonum::messages::MessageBuffer;
let data = vec![1, 2, 3];
let message_buffer = MessageBuffer::from_vec(data.clone());
assert_eq!(data.len(), message_buffer.len());
Returns true
if the MessageBuffer
contains no bytes.
use exonum::messages::MessageBuffer;
let message_buffer = MessageBuffer::from_vec(vec![]);
assert!(message_buffer.is_empty());
Returns the protocol version.
Returns id of the service.
Returns type of the message.
pub fn body(&self) -> &[u8] | [src] |
Returns message body without signature.
Returns signature of the message.
Checks that Field
can be safely got with specified from
and to
offsets.
Returns Field
specified by from
and to
offsets. Should not be used directly.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Writes the hex string representing self
into w
. Lower case letters are used (e.g. f9b4ca
). Read more
Writes the hex string representing self
into w
. Upper case letters are used (e.g. F9B4CA
). Read more