Trait num_format::WriteFormatted
source · pub trait WriteFormatted {
// Required method
fn write_formatted<F, N>(
&mut self,
n: &N,
format: &F
) -> Result<usize, Error>
where F: Format,
N: ToFormattedString;
}
Expand description
A key trait. Gives types in the standard library that implement io::Write
or fmt::Write
, such as &mut [u8]
and &mut String
, a write_formatted
method for writing
formatted numbers.
Required Methods§
sourcefn write_formatted<F, N>(&mut self, n: &N, format: &F) -> Result<usize, Error>where
F: Format,
N: ToFormattedString,
fn write_formatted<F, N>(&mut self, n: &N, format: &F) -> Result<usize, Error>where F: Format, N: ToFormattedString,
Formats the provided number according to the provided format and then writes the resulting
bytes to the object. Meant to be analagous to io::Write
’s write_all
method or
fmt::Write
’s write_str
method. On success, returns the number of bytes written.
Errors
Returns an io::Error
under the same conditions as io::Write
’s write_all
method.