Crate bitcoin_io

Crate bitcoin_io 

Source
Expand description

Rust Bitcoin I/O Library

The std::io module is not exposed in no-std Rust so building no-std applications which require reading and writing objects via standard traits is not generally possible. Thus, this library exists to export a minimal version of std::io’s traits which we use in rust-bitcoin so that we can support no-std applications.

These traits are not one-for-one drop-ins, but are as close as possible while still implementing std::io’s traits without unnecessary complexity.

For examples of how to use and implement the types and traits in this crate see io.rs in the github.com/rust-bitcoin/rust-bitcoin/bitcoin/examples/ directory.

Re-exports§

pub extern crate hashes;

Structs§

Cursor
Wraps an in memory buffer providing position functionality for read and write.
Error
The io crate error type.
FromStd
A bridging wrapper providing the I/O traits for types that already implement std I/O traits.
Sink
A sink to which all writes succeed.
Take
Reader adapter which limits the bytes read from an underlying reader.
ToStd
A bridging wrapper providing the std traits for types that already implement our traits.

Enums§

ErrorKind
A minimal subset of std::io::ErrorKind which is used for Error.
ReadError
An error that can occur when reading and decoding from a buffered reader.

Traits§

BufRead
A trait describing an input stream that uses an internal buffer when reading.
Read
A generic trait describing an input stream.
Write
A generic trait describing an output stream.

Functions§

decode_from_read
Decodes an object from a buffered reader.
decode_from_read_unbuffered
Decodes an object from an unbuffered reader using a fixed-size buffer.
decode_from_read_unbuffered_with
Decodes an object from an unbuffered reader using a custom-sized buffer.
encode_to_writer
Encodes a consensus_encoding object to an I/O writer.
from_std
Wraps a std I/O type to implement the traits from this crate.
from_std_mut
Wraps a mutable reference to std I/O type to implement the traits from this crate.
hash_reader
Hashes data from a reader.
sink
Returns a sink to which all writes succeed.

Type Aliases§

Result
Result type returned by functions in this crate.