fluidattacks-blends-domain 0.17.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::syntax::fields::ruby::module;
use crate::{
    syntax::{builders::namespace::build_namespace_node, SyntaxGraphArgs, SyntaxGraphError},
    utilities::text_nodes::node_to_str,
    NodeId,
};

pub fn reader(
    args: &mut SyntaxGraphArgs<'_>,
    n_id: NodeId,
) -> Result<Option<NodeId>, SyntaxGraphError> {
    let graph = args.ast_graph;

    let name_id = args.required_field_alt(n_id, module::NAME)?;
    let name_str = node_to_str(graph, name_id);
    let block_id = args.optional_field_alt(n_id, module::BODY);

    build_namespace_node(args, n_id, name_str, block_id).map(Some)
}