Macro rasn_smi::object_type

source ·
macro_rules! object_type {
    (
        $(#[$($tree:tt)+])*
        $vi: vis struct $name: ident { $($field_vi:vis $field:ident : $field_ty:ty),* $(,)? }
        access: $access_variant: ident,
        status: $status_variant: ident,
        value = $const_oid: expr;

        $($rest:tt)*
    ) => { ... };
    (
        $(#[$($tree:tt)+])*
        $vi: vis struct $name: ident ($fv: vis $typ: ty);
        access: $access_variant: ident,
        status: $status_variant: ident,
        value = $const_oid: expr;

        $($rest:tt)*
    ) => { ... };
    (
        $(#[$($tree:tt)+])*
        $vi: vis opaque struct $name: ident ($fv: vis $typ: ty);
        access: $access_variant: ident,
        status: $status_variant: ident,
        value = $const_oid: expr;

        $($rest:tt)*
    ) => { ... };
    (
        $(#[$($tree:tt)+])*
        impl $header:tt $(for $typ:path)? {
            $($block:tt)*
        }

        $($rest:tt)*
    ) => { ... };
    () => { ... };
}
Expand description

A declarative macro for generating SMI objects. This macro accepts a list of statements preceeded by a struct-like definition

rasn_smi::object_type! {
    /// A textual description of the entity.  This value should include the
    /// full name and version identification of the system's hardware type,
    /// software operating-system, and networking software.
    #[derive(Debug, PartialEq, PartialOrd, Ord, Eq, Hash)]
    pub struct Descr(pub rasn::types::OctetString);
    access: ReadOnly,
    status: Current,
    value = [1, 3, 6, 1, 2, 1, 1, 1];
}