Crates.io | ckb-rust-std |
lib.rs | ckb-rust-std |
version | 1.0.0 |
source | src |
created_at | 2024-11-26 02:26:06.739099 |
updated_at | 2024-11-26 02:26:06.739099 |
description | A collection of `no_std` compatible modules ported from Rust's standard library, with an initial focus on the `io` module. |
homepage | |
repository | https://github.com/XuJiandong/ckb-rust-std |
max_upload_size | |
id | 1461118 |
size | 295,203 |
A collection of no_std
compatible modules ported from Rust's standard library,
with an initial focus on the io
module. This crate provides essential
functionality for no_std
environments while maintaining API compatibility with
std
. Additional modules may be added in future releases.
Currently, Rust lacks a standard no_std
I/O implementation (see
rust#48331 and
rfcs#2262). While we await an
official implementation, this crate provides the necessary I/O functionality for
no_std
environments.
no_std
io
module compatibility for embedded and bare-metal environmentsstd::io
with identical semantics and APIFor Rust versions prior to 1.81.0, core::error::Error
is not available in no_std
environments. To maintain compatibility:
rust_before_181
feature flag in your Cargo.toml
:
[dependencies]
ckb-rust-std = { version = "...", features = ["rust_before_181"] }
We strongly recommend using Rust 1.81 or later as it provides better error handling features.
std::io
is this ported from?This crate is ported from Rust 1.81's std::io
implementation.
Since this is a direct port of std::io
, we refer users to the official Rust
std::io documentation. All traits,
types, and functions maintain identical behavior and semantics to their std
counterparts.
core::io
if it is implemented?When an official core::io
implementation becomes available, migration should be straightforward:
ckb-rust-std::io
with core::io
Cargo.toml
dependencies to remove this crateFor example:
// Before
use ckb_rust_std::io::{Read, Write};
// After
use core::io::{Read, Write};
copy()
for specific types, due to the lack of
specialization in stable RustSizeHint
implementations for certain iterators, due to the lack of
specialization in stable Rustread_vectored()
and related functions) due to limited
use cases in no_std
environmentsrepr
)stdio
module