nativeview-codegen 0.1.0-rc.1

Multi-language ABI, policy, flat-op codec, and hybrid Direct-FFI code generator for Native View Engine.
Documentation
//! Input specification parsers: React Native specs (`rn_spec`) and declarative hybrid Rust specs
//! (`hybrid_spec`, delegated to [`nativeview_hybrid_spec::frontend`]).

pub mod rn_spec;

/// Declarative hybrid Rust spec frontend (delegated to [`nativeview_hybrid_spec::frontend`]).
pub mod hybrid_spec {
    use std::path::Path;

    use crate::error::CodegenError;
    use crate::schema::hybrid::HybridFileSpec;

    /// Parses a declarative Rust `.rs` hybrid specification source string into a validated
    /// [`HybridFileSpec`].
    pub fn parse_hybrid_rust_spec(source: &str) -> Result<HybridFileSpec, CodegenError> {
        nativeview_hybrid_spec::parse_hybrid_rust_spec(source).map_err(CodegenError::from)
    }

    /// Reads and parses a `.rs` hybrid specification file on disk.
    pub fn parse_hybrid_rust_spec_file(path: &Path) -> Result<HybridFileSpec, CodegenError> {
        nativeview_hybrid_spec::parse_hybrid_rust_spec_file(path).map_err(CodegenError::from)
    }
}

pub use hybrid_spec::{parse_hybrid_rust_spec, parse_hybrid_rust_spec_file};
pub use rn_spec::{parse_rn_spec, parse_rn_spec_file};