fluidattacks-blends-domain 0.17.1

Blends functional core: pure AST graph to syntax graph (no_std)
Documentation
use crate::{
    query::match_ast_d,
    syntax::{
        builders::string_literal::build_string_literal_node, SyntaxGraphArgs, SyntaxGraphError,
    },
    utilities::text_nodes::node_to_str,
    NodeId,
};
use alloc::string::String;

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

    let value = match_ast_d(graph, n_id, "text", None)
        .map_or_else(String::new, |text_id| node_to_str(graph, text_id));

    build_string_literal_node(args, n_id, value, &[]).map(Some)
}