Crates.io | lgio |
lib.rs | lgio |
version | 0.1.0 |
source | src |
created_at | 2023-05-30 15:53:31.113648 |
updated_at | 2023-05-30 15:53:31.113648 |
description | Lightweight, generic, no_std IO. |
homepage | |
repository | https://github.com/Kixunil/lgio |
max_upload_size | |
id | 878036 |
size | 44,017 |
Less error-prone, no_std
IO traits generic over their error types.
This is a simplified version of genio
containing only buffered
traits.
std
no_std
- doesn't require an operating systemread
and write
methods which are often mistaken for read_all
or
write_all
genio
unsafe
to deal with uninitialized bytes (currently none, may change in the future)read
and write
methods which are often mistaken for read_all
or
write_all
FlushError
makes error handling simplerMainly serialization libraries and their consumers.
Can be also usful for simple protocols that don't need precise control of read
and write
calls.
Probably should not be used in lower layers.
The [BufRead
] trait is very similar to the one from std
. The biggest differences are error
type and lack of error-prone read
method. Since it is implemented on std::io::BufReader
and
primitive std
types you can use it exactly the same as [std::io::BufRead
] in most cases.
There's an added benefit that you can statically prove reading from &[u8]
will not fail (but
it can return UnexpectedEnd
).
Similarly, [BufWrite
] is just [std::io::Write
] with error being associated and missing
write
method. It still requires that writing is either buffered or fast because that's what
most encoders need.
std
- integration with the standard library: implementations and adaptersalloc
- additional features requiring allocationThe crate intends to have conservative MSRV and only bump it when it provides significant benefit and at most to the version available in latest Debian stable. Currently tested MSRV is 1.41.1 (Debian oldstable) but due to its simplicity it's possible it works on even lower versions.
Some features may be only available in newer Rust versions. Thus it is recommended to use recent Rust if possible.