Macro rocket::mtls::oid::asn1_rs::int

source ·
macro_rules! int {
    (raw $item:expr) => { ... };
    (rel $item:expr) => { ... };
    ($item:expr) => { ... };
}
Available on crate feature mtls only.
Expand description

Helper macro to declare integers at compile-time

Integer stores the encoded representation of the integer, so declaring an integer requires to either use a runtime function or provide the encoded value. This macro simplifies this task by encoding the value. It can be used the following ways:

  • int!(1234): Create a const expression for the corresponding Integer<'static>
  • int!(raw 1234): Return the DER encoded form as a byte array (hex-encoded, big-endian representation from the integer, with leading zeroes removed).

§Examples

use asn1_rs::{int, Integer};

const INT0: Integer = int!(1234);