Skip to main content

SourceLanguage

Trait SourceLanguage 

Source
pub trait SourceLanguage:
    Debug
    + Clone
    + PartialEq
    + Eq
    + Sized {
    type Warning: Diagnostic + Clone + PartialEq;

    const ERROR_CODE: &'static str;

    // Required method
    fn import(source_text: &str) -> Import<Self>;
}
Expand description

Name a source language by the code of its errors and the type of its warnings, and import its text.

Required Associated Constants§

Source

const ERROR_CODE: &'static str

Spell the stable diagnostic code of the language’s errors.

Required Associated Types§

Source

type Warning: Diagnostic + Clone + PartialEq

Type the warnings the language raises beside its errors.

Required Methods§

Source

fn import(source_text: &str) -> Import<Self>

Import source_text into its model admission, keeping every error and warning on the way.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl SourceLanguage for D2Language

Source§

const ERROR_CODE: &'static str = "svugy::d2::syntax"

Source§

type Warning = UnsupportedConstruct

Source§

impl SourceLanguage for JsonLanguage

Source§

const ERROR_CODE: &'static str = "svugy::malformed_json"

Source§

type Warning = NoWarning

Source§

impl SourceLanguage for MarkdownLanguage

Source§

const ERROR_CODE: &'static str = "svugy::markdown"

Source§

type Warning = NoWarning