pub trait StepFns<T> {
// Required methods
fn add_one(start: &T) -> T;
fn sub_one(start: &T) -> T;
}
Expand description
Successor and predecessor functions defined for T
,
but as free functions rather than methods on T
itself.
This is useful as a workaround for Rust’s “orphan rules”,
which prevent you from implementing StepLite
for T
if T
is a foreign type.
NOTE: This will likely be deprecated and then eventually
removed once the standard library’s Step
trait is stabilised, as most crates will then likely implement Step
for their types where appropriate.
See this issue for details about that stabilization process.
There is also a blanket implementation of StepFns
for all
types implementing StepLite
. Consumers of this crate should
prefer to implement StepLite
for their own types, and only
fall back to StepFns
when dealing with foreign types.
Required Methods§
Object Safety§
This trait is not object safe.