This crate provides:
Extension traits for many standard/core library types/traits.
SelfOps:to extend all types with generic operations.
Type-level representations of bool and unsafe .
Marker traits to encode invariants about types.
To use this crate in no_std contexts disable the default-feature.
Supported Rust versions
This crate support Rust back to 1.20, using a build script to automatically enable features from newer versions.
"std":Enables standard library support.Enabled by default.
"serde_":Enables serde support.Disabled by default.
"typenum":Enables trait impls for typenum types.Disabled by default.
This is implemented for all types.
The most importand methods in this are:
piped: Allows emulating the pipeline operator.
mutated: Allows mutating
selfwith a closure passing it along the method chain
observe: Observes the value of
selfwith a closure passing it along the method chain unmodified.
Other extension traits
ResultExt::Extension trait for [Result].
OptionExt::Extension trait for [Option].
BoolExt:Extension trait for bool.
IntegerExt:Extension trait for integers.
StringExtExtension trait for
MarkerType: Represents a zero-sized marker type.
ResultLike: Trait for types with item/error values,like Option and Result.
TransparentNewtype Represents a newtype that is safe to transmute to and/from its only non-zero-sized field.
IteratorExt Extension trait for [Iterator] implementors.
IterCloner: Constructs [Iterator]s by cloning the one it references,only possible if it is Clone.
IterConstructor: Constructs [Iterator]s using a closure,this can be done multiple times if the closure it Copy.
Loop: Iterator that infinitely produces a value by calling an impl FnMut()->T
LazyOnce: Lazy version of [::std::iter::Once],only evaluating the item when [Iterator::next] is called.
This crate contains
types and operations using type-level
TypeIdentity Allows converting a type back to itself.Useful in generic contexts.
Void: Uninstantiable Type for statically impossible situations. Useful as a type parameter/associated type.
(Un)safety represented as type
maybe_unsafe emulates a safe/unsafe effect using types.
Allows having traits whose implementations can choose whether their methods/functions are safe to call or not.