fixed_alias

Macro fixed_alias 

Source
macro_rules! fixed_alias {
    ($vis:vis $name:ident, $size:literal) => { ... };
    ($name:ident, $size:literal) => { ... };
}
Expand description

Creates a type alias for a fixed-size secure secret.

This macro generates a type alias to Fixed<[u8; N]> with optional visibility. The generated type inherits all methods from Fixed, including .expose_secret().

§Syntax

  • fixed_alias!(Name, size); — public alias
  • fixed_alias!(vis Name, size); — custom visibility (e.g., pub(crate))

§Examples

Basic public alias:

use secure_gate::fixed_alias;
fixed_alias!(Aes256Key, 32);
let key = Aes256Key::new([0u8; 32]);
assert_eq!(key.len(), 32);

With custom visibility:

use secure_gate::fixed_alias;

// crate-visible only
fixed_alias!(pub(crate) InternalKey, 64);

// visible only to the parent module (valid inside a module)
// fixed_alias!(pub(in super) ModuleKey, 16);

pub(in super) and other path-based visibilities are fully supported when used inside real modules, but cannot be demonstrated in top-level doc-tests.

The generated type is zero-cost and works with all features.