Crate genio [] [src]

This crate provides more generic alternatives to std::io::* traits and types. std::io suffers several issues because of over-use of std::io::Error type. One of them is allocation when creating Error type, other is inability to cleanly define errors which make sense in particular implementation, impossibility of use in no_std environments and more.

To solve these problems, genio::Read, genio::Write and other traits are allowed to define their own error types. Together with other utilities and std glue they provide a way to write more clear, portable and re-usable code.

Modules

bufio

Contains traits and impls for buffering.

error

Error types and various operations on them.

ext

This module contains various extension traits.

std_impls

This module contains glue for std::io and other std types.

util

This module contains various generic utilities related to IO.

Traits

ExtendFromReader

This trait is similar to slow one. The difference is that thanks to reader guaranteeing correctness, this one can use uninitialized buffer.

ExtendFromReaderSlow

Some types can be extended by reading from reader. The most well-known is probably Vec. It is possible to implement it manually, but it may be more efficient if the type implements this trait directly. In case of Vec, it means reading directly into uninitialized part of reserved memory in case of the fast version of this trait.

Read

The Read trait allows for reading bytes from a source.

ReadOverwrite

This marker trait declares that the Read trait is implemented correctly, that means:

Write

A trait for objects which are byte-oriented sinks.