pub trait WriteInto: Dimension {
// Required method
fn try_write_into_with_sep<S: Write + ?Sized>(
&self,
s: &mut S,
sep: impl Separators,
) -> Result<()>;
// Provided methods
fn try_write_into<S: Write + ?Sized>(&self, s: &mut S) -> Result<()> { ... }
fn try_write_into_string_with_sep(
&self,
sep: impl Separators,
) -> Result<String> { ... }
fn try_write_into_string(&self) -> Result<String> { ... }
fn try_write_with_sep(&self, sep: impl Separators) -> Result<()> { ... }
fn try_write(&self) -> Result<()> { ... }
}
Expand description
Write into a stream.
- Most types that implement std::fmt::Display also implement this.
- Vec and
[T]
whereT
implements std::fmt::Display also implements this. They write each item separated by a space. - Mat where
T
implements std::fmt::Display also implements this. They write each row separated by a newline, and each item in a row separated by a space.
Required Methods§
Sourcefn try_write_into_with_sep<S: Write + ?Sized>(
&self,
s: &mut S,
sep: impl Separators,
) -> Result<()>
fn try_write_into_with_sep<S: Write + ?Sized>( &self, s: &mut S, sep: impl Separators, ) -> Result<()>
Write into a stream with given separator.
Provided Methods§
Sourcefn try_write_into<S: Write + ?Sized>(&self, s: &mut S) -> Result<()>
fn try_write_into<S: Write + ?Sized>(&self, s: &mut S) -> Result<()>
Write into a stream using the default separator.
Sourcefn try_write_into_string_with_sep(&self, sep: impl Separators) -> Result<String>
fn try_write_into_string_with_sep(&self, sep: impl Separators) -> Result<String>
Write into a string with given separator.
Sourcefn try_write_into_string(&self) -> Result<String>
fn try_write_into_string(&self) -> Result<String>
Write into a string using the default separator.
Sourcefn try_write_with_sep(&self, sep: impl Separators) -> Result<()>
fn try_write_with_sep(&self, sep: impl Separators) -> Result<()>
Write into std::io::Stdout with given separator.
Sourcefn try_write(&self) -> Result<()>
fn try_write(&self) -> Result<()>
Write into std::io::Stdout using the default separator.
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.