macro_rules! int {
(raw $item:expr) => { ... };
(rel $item:expr) => { ... };
($item:expr) => { ... };
}
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 correspondingInteger<'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);