Skip to main content

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 encoding;
pub extern crate hashes;

Re-exports§

pub use self::error::Error;
pub use self::error::ErrorKind;
pub use self::error::ReadError;

Modules§

error
Error types for the io crate.

Structs§

Cursor
Wraps an in memory buffer providing position functionality for read and write.
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.

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.
decode_from_read_with
Decodes an object from a buffered reader using a Decoder type.
drain_to_writer
Drains the output of an Encoder to an I/O writer.
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.