pub struct CairoFormatter { /* private fields */ }
Expand description
A struct for formatting cairo files.
The formatter can operate on all types implementing the FormattableInput
trait.
Allows formatting in place, and for formatting to a string.
Implementations§
Source§impl CairoFormatter
impl CairoFormatter
pub fn new(formatter_config: FormatterConfig) -> Self
Sourcepub fn walk(&self, path: &Path) -> WalkBuilder
pub fn walk(&self, path: &Path) -> WalkBuilder
Returns a preconfigured ignore::WalkBuilder
for the given path.
Can be used for recursively formatting a directory under given path.
Sourcepub fn format_in_place(
&self,
input: &dyn FormattableInput,
) -> Result<FormatOutcome, FormattingError>
pub fn format_in_place( &self, input: &dyn FormattableInput, ) -> Result<FormatOutcome, FormattingError>
Formats the path in place, writing changes to the files. The [‘FormattableInput’] trait implementation defines the method for persisting changes.
Sourcepub fn format_to_string(
&self,
input: &dyn FormattableInput,
) -> Result<FormatOutcome, FormattingError>
pub fn format_to_string( &self, input: &dyn FormattableInput, ) -> Result<FormatOutcome, FormattingError>
Formats the path and returns the formatted string. No changes are persisted. The original file is not modified.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CairoFormatter
impl RefUnwindSafe for CairoFormatter
impl Send for CairoFormatter
impl Sync for CairoFormatter
impl Unpin for CairoFormatter
impl UnwindSafe for CairoFormatter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more