Skip to main content

Crate gatekeep_fluent

Crate gatekeep_fluent 

Source
Expand description

Fluent-backed reason catalog for gatekeep denial reasons.

use gatekeep::{DenialReason, DenyShape, Locale, ReasonCatalog, ReasonCode};
use gatekeep_fluent::FluentCatalog;

let catalog = FluentCatalog::new()
    .with_resource("en-US", "case-read-denied = You cannot read this case.")?;
let reason = DenialReason {
    code: ReasonCode::new("case-read-denied")?,
    params: Default::default(),
    shape: DenyShape::Forbidden,
};

assert_eq!(
    catalog.render(&reason, &Locale::new("en-US")?),
    "You cannot read this case."
);

Structs§

FluentCatalog
Fluent catalog keyed by gatekeep reason codes.

Enums§

FluentCatalogError
Errors returned while building a FluentCatalog.