fluidattacks-blends-domain 0.6.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
//! Type-level field keys.
//!
//! A key carries its grammar cardinality in its type, so the
//! required-versus-optional choice is decided by the compiler rather than by
//! each reader. The per-language tables below are generated from the
//! tree-sitter grammars and must not be edited by hand.

#[allow(dead_code)]
pub mod c_sharp;
#[allow(dead_code)]
pub mod elixir;
#[allow(dead_code)]
pub mod go;
#[allow(dead_code)]
pub mod hcl;
#[allow(dead_code)]
pub mod java;
#[allow(dead_code)]
pub mod javascript;
pub mod json;
#[allow(dead_code)]
pub mod kotlin;
#[allow(dead_code)]
pub mod php;
#[allow(dead_code)]
pub mod python;
#[allow(dead_code)]
pub mod ruby;
#[allow(dead_code)]
pub mod rust;
#[allow(dead_code)]
pub mod scala;
#[allow(dead_code)]
pub mod swift;
#[allow(dead_code)]
pub mod typescript;
pub mod yaml;

#[derive(Clone, Copy)]
pub struct Field<const REQUIRED: bool> {
    name: &'static str,
}

impl<const REQUIRED: bool> Field<REQUIRED> {
    #[must_use]
    pub const fn new(name: &'static str) -> Self {
        Self { name }
    }
}

pub trait OptionalField {
    fn name(self) -> &'static str;
}

impl OptionalField for Field<false> {
    fn name(self) -> &'static str {
        self.name
    }
}

pub trait RequiredField {
    fn name(self) -> &'static str;
}

impl RequiredField for Field<true> {
    fn name(self) -> &'static str {
        self.name
    }
}