pub trait Lang{
type Config;
type Format: Default;
type Item: LangItem<Self>;
// Provided methods
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 { ... }
}
Expand description
Trait to implement for language specialization.
The various language implementations can be found in the lang module.
Required Associated Types§
Provided Methods§
Sourcefn default_indentation() -> Indentation
fn default_indentation() -> Indentation
Provide the default indentation.
Sourcefn open_quote(
out: &mut Formatter<'_>,
_config: &Self::Config,
_format: &Self::Format,
_has_eval: bool,
) -> Result
fn open_quote( out: &mut Formatter<'_>, _config: &Self::Config, _format: &Self::Format, _has_eval: bool, ) -> Result
Start a string quote.
Sourcefn close_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
End a string quote.
Sourcefn string_eval_literal(
out: &mut Formatter<'_>,
config: &Self::Config,
format: &Self::Format,
literal: &str,
) -> Result
fn string_eval_literal( out: &mut Formatter<'_>, config: &Self::Config, format: &Self::Format, literal: &str, ) -> Result
A simple, single-literal string evaluation.
Sourcefn start_string_eval(
_out: &mut Formatter<'_>,
_config: &Self::Config,
_format: &Self::Format,
) -> Result
fn start_string_eval( _out: &mut Formatter<'_>, _config: &Self::Config, _format: &Self::Format, ) -> Result
Start a string-interpolated eval.
Sourcefn end_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
End a string interpolated eval.
Sourcefn write_quoted(out: &mut Formatter<'_>, input: &str) -> Result
fn write_quoted(out: &mut Formatter<'_>, input: &str) -> Result
Performing string quoting according to language convention.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.