Skip to content

Commit 45d62f6

Browse files
committed
Improve the doc
1 parent 885716f commit 45d62f6

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cvt"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Marcin Mielniczuk <[email protected]>"]
55
edition = "2018"
66
license = "Apache-2.0"

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
[crates-io]: https://crates.io/crates/cvt
88

99
This package exposes the `cvt` function used extensively by `libstd` to
10-
convert platform-specific syscall error codes.
10+
convert platform-specific syscall error codes to `std::io::Result`.
1111

12-
The code was mostly copied over from Rust libstd.
12+
Usually syscalls use return values for errors, the conventions differ. For instance,
13+
on Unix `0` means success on Unix but failure on Windows.
14+
15+
While those conventions are not always followed, they usually are and
16+
`cvt` is there to reduce the mental bookkeeping and make it easier to handle syscall errors.
17+
18+
The code was mostly copied over from Rust libstd, because the function is not public.

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
//! This package exposes the `cvt` function used extensively by `libstd` to
2+
//! convert platform-specific syscall error codes to `std::io::Result`.
3+
//!
4+
//! Usually syscalls use return values for errors, the conventions differ. For instance,
5+
//! on Unix `0` usually means success on Unix but failure on Windows.
6+
//! While those conventions are not always followed, they usually are and
7+
//! `cvt` is there to reduce the mental bookkeeping and make it easier to handle syscall errors.
8+
//!
9+
//! The code was mostly copied over from Rust libstd, because the function is not public.
10+
111
cfg_if::cfg_if! {
212
if #[cfg(target_os = "vxworks")] {
313
mod vxworks;

0 commit comments

Comments
 (0)