Crates.io | rs-std-ext |
lib.rs | rs-std-ext |
version | 0.2.0 |
source | src |
created_at | 2024-05-12 02:37:16.487575 |
updated_at | 2024-05-16 04:32:55.935195 |
description | An extension for the standard library. |
homepage | https://github.com/Embers-of-the-Fire/rust-std-ext |
repository | https://github.com/Embers-of-the-Fire/rust-std-ext.git |
max_upload_size | |
id | 1237197 |
size | 57,107 |
rs-std-ext
This crate provides some additions to the standard library api.
In general, the extensions provided by this crate are based on rust's trait system, so you only need to import the provided traits to use the extension methods.
Take std::option::Option
as an example:
// import the trait
use rs_std_ext::option::OptionExt;
let op: Option<usize> = Some(42);
assert_eq! (
// this method is defined by the `OptionExt` trait
op.is_none_or(|x| *x > 0),
true
);
For extended methods, read the documentation on docs.rs.
The layout of the extension trait basically matches the layout of rust std and rust core,
with Ext
as a suffix, e.g. the trait for std::option::Option
is rs_std_ext::option::OptionExt
.
This crate is licensed under the MIT License or the Apache v2.0 License.