Trait num_enum::UnsafeFromPrimitive
source · pub trait UnsafeFromPrimitive: Sized {
type Primitive: Copy + Eq;
// Required method
unsafe fn unchecked_transmute_from(number: Self::Primitive) -> Self;
// Provided method
unsafe fn from_unchecked(number: Self::Primitive) -> Self { ... }
}
Required Associated Types§
Required Methods§
sourceunsafe fn unchecked_transmute_from(number: Self::Primitive) -> Self
unsafe fn unchecked_transmute_from(number: Self::Primitive) -> Self
Transmutes into an enum from its primitive.
Safety
number
must represent a valid discriminant ofSelf
.
Provided Methods§
sourceunsafe fn from_unchecked(number: Self::Primitive) -> Self
unsafe fn from_unchecked(number: Self::Primitive) -> Self
👎Deprecated since 0.6.0: Prefer to use
unchecked_transmute_from
, from_unchecked
will be removed in a future release.Transmutes into an enum from its primitive.
Safety
number
must represent a valid discriminant ofSelf
.