[][src]Crate writeable

writeable is a utility crate of the ICU4X project.

It includes Writeable, a core trait representing an object that can be written to a sink implementing std::fmt::Write. It is an alternative to std::fmt::Display with the addition of a function indicating the number of bytes to be written.

Writeable improves upon std::fmt::Display in two ways:

  1. More efficient, since the sink can pre-allocate bytes.
  2. Smaller code, since the format machinery can be short-circuited.

Types implementing Writeable automatically implement ToString. Because of this, you cannot implement both Writeable and std::fmt::Display on the same type.

Macros

assert_writeable_eq

Testing macro for types implementing Writeable. The first argument should be a string, and the second argument should be a &dyn Writeable.

Traits

Writeable

Writeable is an alternative to std::fmt::Display with the addition of a length function.