Skip to main content

SWrite

Trait SWrite 

Source
pub trait SWrite {
    // Required methods
    fn swrite_fmt(&mut self, fmt: Arguments<'_>);
    fn swrite_fmt_nl(&mut self, fmt: Arguments<'_>);
}
Expand description

Implementing this trait allows using the swrite! and swriteln! macros.

Required Methods§

Source

fn swrite_fmt(&mut self, fmt: Arguments<'_>)

Write formatted text.

For types implementing std::fmt::Write this is usually done with just a call to std::fmt::Write::write_fmt ignoring the result.

Make sure that write_fmt() never returns Err(_).

Source

fn swrite_fmt_nl(&mut self, fmt: Arguments<'_>)

Write formatted text to the given String, followed by a newline.

For types implementing std::fmt::Write this is usually done with just a call to std::fmt::Write::write_fmt, followed by a type-specific way of appending a newline.

Make sure that write_fmt() never returns Err(_).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl SWrite for OsString

Available on crate feature osstring only.
Source§

fn swrite_fmt(&mut self, fmt: Arguments<'_>)

Source§

fn swrite_fmt_nl(&mut self, fmt: Arguments<'_>)

Source§

impl SWrite for String

Source§

fn swrite_fmt(&mut self, fmt: Arguments<'_>)

Source§

fn swrite_fmt_nl(&mut self, fmt: Arguments<'_>)

Implementors§