Skip to the content.

ADR-0021: Rust Native Extension (gnat-core)

Decision: Optional PyO3/maturin Rust extension for hot-path IOC functions; pure Python always available as fallback.

Why Rust for IOC classification:

Shim pattern:

try:
    from gnat._core import classify_ioc, defang, refang, ...
    RUST_AVAILABLE = True
except ImportError:
    RUST_AVAILABLE = False
    def classify_ioc(value): ...   # pure-Python equivalent

This means RUST_AVAILABLE is a public API flag; all callers check it in tests.

Build targets:

Extras group: pip install "gnat[fast]" documents the native extension as optional. The core library never requires it — the extra is purely for performance-critical deployments.


Licensed under the Apache License, Version 2.0