pub trait AnyPinwhere
Self: Sealed,
Self: From<SpecificPin<Self>>,
Self: Into<SpecificPin<Self>>,
Self: AsRef<SpecificPin<Self>>,
Self: AsMut<SpecificPin<Self>>,{
type Id: PinId;
type Mode: PinMode;
}
Expand description
Type class for Pin
types
This trait uses the AnyKind
trait pattern to create a type class for
Pin
types. See the AnyKind
documentation for more details on the
pattern.
v1
Compatibility
Normally, this trait would use Is<Type = SpecificPin<Self>>
as a super
trait. But doing so would restrict implementations to only the v2
Pin
type in this module. To aid in backwards compatibility, we want to implement
AnyPin
for the v1
Pin
type as well. This is possible for a few
reasons. First, both structs are zero-sized, so there is no meaningful
memory layout to begin with. And even if there were, the v1
Pin
type is
a newtype wrapper around a v2
Pin
, and single-field structs are
guaranteed to have the same layout as the field, even for repr(Rust)
.