3 releases (breaking)
0.3.0 | Oct 2, 2024 |
---|---|
0.2.0 | May 16, 2024 |
0.1.0 | May 12, 2024 |
#954 in Rust patterns
220 downloads per month
55KB
799 lines
rs-std-ext
This crate provides some additions to the standard library api.
How to use
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
// Note: The method is deprecated. Use std's method instead.
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
.
License
This crate is licensed under the MIT License or the Apache v2.0 License.
Dependencies
~75KB