alloc and unreliable only.Expand description
This module contains a set of functions, traits and macros that depend on undocumented standard library behavior and should therefore be used with caution.
Library tests ensure that the impls_trait checks are performed at compile
time and are fully optimized with no runtime cost at opt-level >= 1. Note
that the release profile uses opt-level = 3 by default.
§Reliability
While it is unlikely, there is still a possibility that functions in this module may return false negatives in future Rust versions.
The correctness of the results returned by the functions depends on the following:
- Documented behavior that if
TimplementsEq, twoRcs that point to the same allocation are always equal: https://doc.rust-lang.org/1.82.0/std/rc/struct.Rc.html#method.eq. - Undocumented behavior that the
Rc::partial_eqimplementation forT: Eqwill not usePartialEq::eqif bothRcs point to the same memory location. - The assumption that the undocumented short-circuit behavior described above will be retained for optimization purposes.
There is no formal guarantee that the undocumented behavior described above
will be retained. If the implementation changes in a future Rust version,
the function may return a false negative, that is, it may return false,
even though T implements the trait. However, the implementation guarantees
that a false positive result is impossible, i.e., the function will never
return true if T does not implement the trait in any future Rust version.
Details:
Macros§
- define_
impls_ trait_ ignore_ lt_ fn - Generates a function which returns
trueif the given type implements specified trait. Note that all the lifetimes are erased and not accounted for.
Traits§
- TrySpecialize
Weak - A extension trait for
TrySpecializetrait for specializing one completely unconstrained type to another completely unconstrained type. - Weak
Specialization - A extension trait for
Specializationtype for specializing one completely unconstrained type to another completely unconstrained type.
Functions§
- impls_
clone_ weak - Returns
trueif the given type implementsClone. - impls_
copy_ weak - Returns
trueif the given type implementsCopy. - impls_
debug_ weak - Returns
trueif the given type implementsDebug. - impls_
default_ weak - Returns
trueif the given type implementsDefault. - impls_
deref_ weak - Returns
trueif the given type implementsDeref. - impls_
display_ weak - Returns
trueif the given type implementsDisplay. - impls_
eq_ weak - Returns
trueif the given type implementsEq. - impls_
fmt_ write_ weak - Returns
trueif the given type implementsFmtWrite. - impls_
from_ str_ weak - Returns
trueif the given type implementsFromStr. - impls_
future_ weak - Returns
trueif the given type implementsFuture. - impls_
hash_ weak - Returns
trueif the given type implementsHash. - impls_
into_ future_ weak - Returns
trueif the given type implementsIntoFuture. - impls_
into_ iterator_ weak - Returns
trueif the given type implementsIntoIterator. - impls_
io_ read_ weak - Returns
trueif the given type implementsIoRead. - impls_
io_ write_ weak - Returns
trueif the given type implementsIoWrite. - impls_
iterator_ weak - Returns
trueif the given type implementsIterator. - impls_
lifetime_ free_ weak - Returns
trueif the given type implementsLifetimeFree. - impls_
ord_ weak - Returns
trueif the given type implementsOrd. - impls_
partial_ eq_ weak - Returns
trueif the given type implementsPartialEq. - impls_
partial_ ord_ weak - Returns
trueif the given type implementsPartialOrd. - impls_
ref_ unwind_ safe_ weak - Returns
trueif the given type implementsRefUnwindSafe. - impls_
send_ weak - Returns
trueif the given type implementsSend. - impls_
sized_ weak - Returns
trueif the given type implementsSized. - impls_
sync_ weak - Returns
trueif the given type implementsSync. - impls_
unpin_ weak - Returns
trueif the given type implementsUnpin. - impls_
unwind_ safe_ weak - Returns
trueif the given type implementsUnwindSafe.