pub trait Formattable {
// Required methods
fn with_prefix_ws<O>(
&mut self,
ctx: &mut Context<'_>,
f: &mut impl FnMut(&mut Whitespace, &mut Context<'_>) -> O,
) -> Result<O, ControlFlow<()>>;
fn with_strings<O>(
&mut self,
ctx: &mut Context<'_>,
exclude_prefix_ws: bool,
f: &mut impl FnMut(&mut AstStr, &mut Context<'_>) -> ControlFlow<O>,
) -> ControlFlow<O, bool>;
fn format_output(&mut self, ctx: &mut Context<'_>) -> FormatOutput;
// Provided methods
fn prefix_ws_is_pure(&mut self, ctx: &mut Context<'_>) -> Option<bool> { ... }
fn prefix_ws_join_prefix(
&mut self,
ctx: &mut Context<'_>,
ws: Whitespace,
) -> Result<(), Whitespace> { ... }
}Expand description
Formattable types
Required Methods§
Sourcefn with_prefix_ws<O>(
&mut self,
ctx: &mut Context<'_>,
f: &mut impl FnMut(&mut Whitespace, &mut Context<'_>) -> O,
) -> Result<O, ControlFlow<()>>
fn with_prefix_ws<O>( &mut self, ctx: &mut Context<'_>, f: &mut impl FnMut(&mut Whitespace, &mut Context<'_>) -> O, ) -> Result<O, ControlFlow<()>>
Accesses the prefix whitespace of this type.
§Return
Ok()if the prefix whitespace was found.Err(Break(()))if no prefix whitespace existed and the type wasn’t emptyErr(Continue(()))if no prefix whitespace existed but the type was empty.
Sourcefn with_strings<O>(
&mut self,
ctx: &mut Context<'_>,
exclude_prefix_ws: bool,
f: &mut impl FnMut(&mut AstStr, &mut Context<'_>) -> ControlFlow<O>,
) -> ControlFlow<O, bool>
fn with_strings<O>( &mut self, ctx: &mut Context<'_>, exclude_prefix_ws: bool, f: &mut impl FnMut(&mut AstStr, &mut Context<'_>) -> ControlFlow<O>, ) -> ControlFlow<O, bool>
Iterates over all strings in this type.
§Returns
Break()iffreturnedBreak()Continue(true)if this type was empty.Continue(false)if this type was non-empty.
Sourcefn format_output(&mut self, ctx: &mut Context<'_>) -> FormatOutput
fn format_output(&mut self, ctx: &mut Context<'_>) -> FormatOutput
Returns the formatting output for this type, without formatting it.
Provided Methods§
Sourcefn prefix_ws_is_pure(&mut self, ctx: &mut Context<'_>) -> Option<bool>
fn prefix_ws_is_pure(&mut self, ctx: &mut Context<'_>) -> Option<bool>
Returns if the prefix whitespace is pure.
Sourcefn prefix_ws_join_prefix(
&mut self,
ctx: &mut Context<'_>,
ws: Whitespace,
) -> Result<(), Whitespace>
fn prefix_ws_join_prefix( &mut self, ctx: &mut Context<'_>, ws: Whitespace, ) -> Result<(), Whitespace>
Joins a string as a prefix onto the prefix whitespace of this type.
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.