# Trait ethcore_util::standard::fmt::Write 1.0.0 [−] [src]

    pub trait Write {
        fn write_str(&mut self, s: &str) -> Result<(), Error>;

        fn write_char(&mut self, c: char) -> Result<(), Error> { ... }
        fn write_fmt(&mut self, args: Arguments) -> Result<(), Error> { ... }
    }

A collection of methods that are required to format a message into a stream.

This trait is the type which this modules requires when formatting information. This is similar to the standard library's `io::Write` trait, but it is only intended for use in libcore.

This trait should generally not be implemented by consumers of the standard library. The `write!` macro accepts an instance of `io::Write`, and the `io::Write` trait is favored over implementing this trait.

## Required Methods

### `fn write_str(&mut self, s: &str) -> Result<(), Error>`

Writes a slice of bytes into this writer, returning whether the write succeeded.

This method can only succeed if the entire byte slice was successfully written, and this method will not return until all data has been written or an error occurs.

# Errors

This function will return an instance of `Error` on error.

## Provided Methods

### `fn write_char(&mut self, c: char) -> Result<(), Error>`
1.1.0

Writes a `char` into this writer, returning whether the write succeeded.

A single `char` may be encoded as more than one byte. This method can only succeed if the entire byte sequence was successfully written, and this method will not return until all data has been written or an error occurs.

# Errors

This function will return an instance of `Error` on error.

### `fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>`

Glue for usage of the `write!` macro with implementors of this trait.

This method should generally not be invoked manually, but rather through the `write!` macro itself.

## Implementors

- `impl Write for String`
- `impl<'a, W> Write for &'a mut W where W: Write + ?Sized`
- `impl<'a> Write for Formatter<'a>`
- `impl<A> Write for ArrayString<A> where A: Array<Item=u8>`

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result
+
  Collapse/expand all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)