Struct rusp::usp::Msg

source ·
pub struct Msg {
    pub header: Option<Header>,
    pub body: Option<Body>,
}

Fields§

§header: Option<Header>§body: Option<Body>

Implementations§

source§

impl<'a> Msg

Implementation of some extension methods for Msgs

source

pub fn msg_id(&'a self) -> &str

Retrieves the message ID from a Msg structure

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]);
assert_eq!(msg.unwrap().msg_id(), "AXSS-1544114045.442596");
source

pub const fn is_request(&'a self) -> bool

Checks whether the body contains a message of type request

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert_eq!(msg.is_request(), true);
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]).unwrap();
assert_eq!(msg.is_request(), false);
source

pub const fn is_notify_request(&'a self) -> bool

Checks whether the body contains a message of type notify (request)

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert_eq!(msg.is_notify_request(), true);
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]).unwrap();
assert_eq!(msg.is_notify_request(), false);
source

pub const fn get_notify_request(&'a self) -> Option<&Notify>

Retrieves the notify request from the Msg

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert!(msg.get_notify_request().is_some());
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]).unwrap();
assert!(msg.get_notify_request().is_none());
source

pub const fn is_response(&'a self) -> bool

Checks whether the body contains a message of type response

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert_eq!(msg.is_response(), false);
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]).unwrap();
assert_eq!(msg.is_response(), true);
source

pub fn is_error(&'a self) -> bool

Checks whether the body contains a message of type response

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert_eq!(msg.is_error(), false);
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]).unwrap();
assert_eq!(msg.is_error(), false);
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x05, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x12,
        0x17, 0x1a, 0x15, 0x0d, 0x5b, 0x1b, 0x00, 0x00,
        0x12, 0x0e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
        0x61, 0x6c, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72,
    ]).unwrap();
assert_eq!(msg.is_error(), true);
source

pub fn get_error(&'a self) -> Option<Error>

Retrieves the notify request from the Msg

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert!(msg.get_error().is_none());
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x1a, 0x0a, 0x16, 0x41, 0x58, 0x53, 0x53, 0x2d, 0x31, 0x35, 0x34,
        0x34, 0x31, 0x31, 0x34, 0x30, 0x34, 0x35, 0x2e, 0x34, 0x34, 0x32, 0x35,
        0x39, 0x36, 0x10, 0x02, 0x12, 0x46, 0x12, 0x44, 0x0a, 0x42, 0x0a, 0x40,
        0x0a, 0x22, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x63,
        0x61, 0x6c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x54, 0x50, 0x2e,
        0x31, 0x2e, 0x57, 0x65, 0x62, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e,
        0x15, 0x62, 0x1b, 0x00, 0x00, 0x1a, 0x15, 0x55, 0x6e, 0x73, 0x75, 0x70,
        0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x70, 0x61, 0x72, 0x61, 0x6d,
        0x65, 0x74, 0x65, 0x72
    ]).unwrap();
assert!(msg.get_error().is_none());
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x05, 0x0a, 0x03, 0x65, 0x72, 0x72, 0x12,
        0x17, 0x1a, 0x15, 0x0d, 0x5b, 0x1b, 0x00, 0x00,
        0x12, 0x0e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e,
        0x61, 0x6c, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72,
    ]).unwrap();
assert!(msg.get_error().is_some());
source§

impl Msg

Implementation of some extension methods for Msgs

source

pub fn to_json(&self) -> Result<String>

Encode the Msg as JSON format

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert_eq!(msg.to_json().unwrap(), "{\"Header\":{\"msg_id\":\"test\",\"msg_type\":\"NOTIFY\"},\"Body\":{\"Request\":{\"Notify\":{\"subscription_id\":\"notif\",\"send_resp\":true,\"on_board_req\":{\"oui\":\"0044FF\",\"product_class\":\"Foo\",\"serial_number\":\"01234\",\"agent_supported_protocol_versions\":\"1.3\"}}}}}");
source

pub fn to_json_pretty(&self) -> Result<String>

Encode the Msg in pretty printed JSON format

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let msg =
    try_decode_msg(&[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ]).unwrap();
assert_eq!(msg.to_json_pretty().unwrap(), "{\n  \"Header\": {\n    \"msg_id\": \"test\",\n    \"msg_type\": \"NOTIFY\"\n  },\n  \"Body\": {\n    \"Request\": {\n      \"Notify\": {\n        \"subscription_id\": \"notif\",\n        \"send_resp\": true,\n        \"on_board_req\": {\n          \"oui\": \"0044FF\",\n          \"product_class\": \"Foo\",\n          \"serial_number\": \"01234\",\n          \"agent_supported_protocol_versions\": \"1.3\"\n        }\n      }\n    }\n  }\n}");
source

pub fn to_vec(&self) -> Result<Vec<u8>>

Encode the Msg into a Protobuf byte stream returned as Vec<[u8]>

§Arguments
  • self - A decoded USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let bytes = &[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ];
let msg = try_decode_msg(bytes).unwrap();
assert_eq!(msg.to_vec().unwrap(), bytes);
source

pub fn to_c_str(&self) -> Result<String>

Render the Msg into a raw C string representation

§Arguments
  • self - A USP Msg structure
§Example
use rusp::usp_decoder::try_decode_msg;
let bytes = &[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ];
let msg = try_decode_msg(bytes).unwrap();
assert_eq!(msg.to_c_str().unwrap(), "\"\\x0a\\x08\\x0a\\x04test\\x10\\x03\\x12(\\x0a\\x26B\\x24\\x0a\\x05notif\\x10\\x01B\\x19\\x0a\\x060044FF\\x12\\x03Foo\\x1a\\x0501234\\x22\\x031.3\"\n");
source

pub fn to_c_array(&self) -> Result<String>

Render the Record into a raw C array representation

§Arguments
  • self - A USP Record structure
§Example
use rusp::usp_decoder::try_decode_msg;
let bytes = &[
        0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74,
        0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24,
        0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10,
        0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34,
        0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f,
        0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22,
        0x03, 0x31, 0x2e, 0x33,
    ];
let msg = try_decode_msg(bytes).unwrap();
assert_eq!(msg.to_c_array().unwrap(), "unsigned int pb_len = 52;\nconst char pb[] = {\n  0x0a, 0x08, 0x0a, 0x04, 0x74, 0x65, 0x73, 0x74, /* ____test */\n  0x10, 0x03, 0x12, 0x28, 0x0a, 0x26, 0x42, 0x24, /* ___(__B_ */\n  0x0a, 0x05, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x10, /* __notif_ */\n  0x01, 0x42, 0x19, 0x0a, 0x06, 0x30, 0x30, 0x34, /* _B___004 */\n  0x34, 0x46, 0x46, 0x12, 0x03, 0x46, 0x6f, 0x6f, /* 4FF__Foo */\n  0x1a, 0x05, 0x30, 0x31, 0x32, 0x33, 0x34, 0x22, /* __01234\" */\n  0x03, 0x31, 0x2e, 0x33,                         /* _1.3 */\n};\n");

Trait Implementations§

source§

impl Clone for Msg

source§

fn clone(&self) -> Msg

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Msg

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Msg

source§

fn default() -> Msg

Returns the “default value” for a type. Read more
source§

impl<'a> MessageRead<'a> for Msg

source§

fn from_reader(r: &mut BytesReader, bytes: &'a [u8]) -> Result<Self>

Constructs an instance of Self by reading from the given bytes via the given reader. Read more
source§

impl MessageWrite for Msg

source§

fn get_size(&self) -> usize

Computes necessary binary size of self once serialized in protobuf
source§

fn write_message<W: WriterBackend>(&self, w: &mut Writer<W>) -> Result<()>

Writes Self into W writer
source§

fn write_file<P>(&self, p: P) -> Result<(), Error>
where P: AsRef<Path>,

Writes self into a file
source§

impl PartialEq for Msg

source§

fn eq(&self, other: &Msg) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Msg

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for Msg

Auto Trait Implementations§

§

impl Freeze for Msg

§

impl RefUnwindSafe for Msg

§

impl Send for Msg

§

impl Sync for Msg

§

impl Unpin for Msg

§

impl UnwindSafe for Msg

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.