asn1_rs

Derive Macro ToStatic

Source
#[derive(ToStatic)]
{
    // Attributes available to this derive:
    #[debug_derive]
}
Expand description

§ToStatic custom derive

ToStatic is a custom derive attribute, to derive the ToStatic trait automatically from the structure definition.

§Example

use asn1_rs::ToStatic;
use std::borrow::Cow;

#[derive(ToStatic)]
struct S<'a>(pub Cow<'a, str>);

§Debugging

To help debugging the generated code, the #[debug_derive] attribute has been added.

When this attribute is specified, the generated code will be printed to stderr during compilation.

Example:

use asn1_rs::ToStatic;
use std::borrow::Cow;

#[derive(ToStatic)]
#[debug_derive]
struct S<'a>(pub Cow<'a, str>);