You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/rust/trezor-client/src/messages/mod.rs

27 lines
776 B

//! This module implements the `message_type` getter for all protobuf message types.
use crate::protos::{MessageType::*, *};
/// Extends the protobuf Message trait to also have a static getter for the message
/// type code.
pub trait TrezorMessage: protobuf::Message + std::fmt::Debug {
const MESSAGE_TYPE: MessageType;
#[inline]
#[deprecated(note = "Use `MESSAGE_TYPE` instead")]
fn message_type() -> MessageType {
Self::MESSAGE_TYPE
}
}
/// This macro provides the TrezorMessage trait for a protobuf message.
macro_rules! trezor_message_impl {
($($struct:ident => $mtype:expr),+ $(,)?) => {$(
impl TrezorMessage for $struct {
const MESSAGE_TYPE: MessageType = $mtype;
}
)+};
}
include!("./generated.rs");