[][src]Trait genco::lang::Lang

pub trait Lang where
    Self: 'static + Sized
{ type Config; type Format: Default; type Import: ?Sized; fn default_indentation() -> Indentation { ... }
fn open_quote(
        out: &mut Formatter,
        _config: &Self::Config,
        _format: &Self::Format,
        _has_eval: bool
    ) -> Result { ... }
fn close_quote(
        out: &mut Formatter,
        _config: &Self::Config,
        _format: &Self::Format,
        _has_eval: bool
    ) -> Result { ... }
fn string_eval_literal(
        out: &mut Formatter,
        config: &Self::Config,
        format: &Self::Format,
        literal: &str
    ) -> Result { ... }
fn start_string_eval(
        _out: &mut Formatter,
        _config: &Self::Config,
        _format: &Self::Format
    ) -> Result { ... }
fn end_string_eval(
        _out: &mut Formatter,
        _config: &Self::Config,
        _format: &Self::Format
    ) -> Result { ... }
fn write_quoted(out: &mut Formatter, input: &str) -> Result { ... }
fn format_file(
        tokens: &Tokens<Self>,
        out: &mut Formatter,
        config: &Self::Config
    ) -> Result { ... } }

Trait to implement for language specialization.

The various language implementations can be found in the lang module.

Associated Types

type Config

Configuration associated with building a formatting element.

type Format: Default

State being used during formatting.

type Import: ?Sized

The type used when resolving imports.

Loading content...

Provided methods

fn default_indentation() -> Indentation

Provide the default indentation.

fn open_quote(
    out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format,
    _has_eval: bool
) -> Result

Start a string quote.

fn close_quote(
    out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format,
    _has_eval: bool
) -> Result

End a string quote.

fn string_eval_literal(
    out: &mut Formatter,
    config: &Self::Config,
    format: &Self::Format,
    literal: &str
) -> Result

A simple, single-literal string evaluation.

fn start_string_eval(
    _out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format
) -> Result

Start a string-interpolated eval.

fn end_string_eval(
    _out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format
) -> Result

End a string interpolated eval.

fn write_quoted(out: &mut Formatter, input: &str) -> Result

Performing string quoting according to language convention.

fn format_file(
    tokens: &Tokens<Self>,
    out: &mut Formatter,
    config: &Self::Config
) -> Result

Write a file according to the specified language convention.

Loading content...

Implementations on Foreign Types

impl Lang for ()[src]

Dummy implementation for a language.

type Config = ()

type Format = ()

type Import = ()

Loading content...

Implementors

impl Lang for Csharp[src]

type Config = Config

type Format = Format

type Import = Import

impl Lang for Dart[src]

type Config = Config

type Format = Format

type Import = Import

fn start_string_eval(
    out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format
) -> Result
[src]

Start a string-interpolated eval.

fn end_string_eval(
    out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format
) -> Result
[src]

End a string interpolated eval.

impl Lang for Go[src]

type Config = Config

type Format = Format

type Import = Import

impl Lang for Java[src]

type Config = Config

type Format = Format

type Import = Import

impl Lang for JavaScript[src]

type Config = Config

type Format = Format

type Import = Import

fn open_quote(
    out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format,
    has_eval: bool
) -> Result
[src]

Start a string quote.

fn close_quote(
    out: &mut Formatter,
    _config: &Self::Config,
    _format: &Self::Format,
    has_eval: bool
) -> Result
[src]

End a string quote.

impl Lang for Python[src]

type Config = Config

type Format = Format

type Import = dyn AsAny

impl Lang for Rust[src]

type Config = Config

type Format = Format

type Import = Import

impl Lang for Swift[src]

type Config = Config

type Format = Format

type Import = Import

Loading content...