Trait serpente::gpio::v2::AnyPin [−][src]
pub trait AnyPin: Sealed + From<Pin<Self::Id, Self::Mode>> + Into<Pin<Self::Id, Self::Mode>> + AsRef<Pin<Self::Id, Self::Mode>> + AsMut<Pin<Self::Id, Self::Mode>> {
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 = SpecificPinv2
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)
.