Skip to main content

Language

Trait Language 

Source
pub trait Language:
    Send
    + Sync
    + 'static {
    // Required methods
    fn describe(&self) -> Description;
    fn parse(&self, row: &str, source: &[u8]) -> Result<Vec<u8>, String>;

    // Provided method
    fn print(&self, row: &str, table: &[u8]) -> Result<Vec<u8>, String> { ... }
}
Expand description

A language supplied at runtime. Called from whichever thread parses or prints, hence Send + Sync; kept for the life of the process, since there is no unregistration.

Required Methods§

Source

fn describe(&self) -> Description

Source

fn parse(&self, row: &str, source: &[u8]) -> Result<Vec<u8>, String>

source to the node table of its parse, as JSON. row is the name the language registered under. An Err is a parse error whose message the library reports.

Provided Methods§

Source

fn print(&self, row: &str, table: &[u8]) -> Result<Vec<u8>, String>

A node table without positions to source. Called only for a language whose description declares write.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§