Enum move_binary_format::file_format::Ability
source · #[repr(u8)]
pub enum Ability {
Copy,
Drop,
Store,
Key,
}
Expand description
An Ability
classifies what operations are permitted for a given type
Variants§
Copy
Allows values of types with this ability to be copied, via CopyLoc or ReadRef
Drop
Allows values of types with this ability to be dropped, via Pop, WriteRef, StLoc, Eq, Neq, or if left in a local when Ret is invoked Technically also needed for numeric operations (Add, BitAnd, Shift, etc), but all of the types that can be used with those operations have Drop
Store
Allows values of types with this ability to exist inside a struct in global storage
Key
Allows the type to serve as a key for global storage operations: MoveTo, MoveFrom, etc.
Implementations§
source§impl Ability
impl Ability
sourcepub fn requires(self) -> Self
pub fn requires(self) -> Self
For a struct with ability a
, each field needs to have the ability a.requires()
.
Consider a generic type Foo<t1, …, tn>, for Foo<t1, …, tn> to have ability a
, Foo must
have been declared with a
and each type argument ti must have the ability a.requires()
sourcepub fn required_by(self) -> AbilitySet
pub fn required_by(self) -> AbilitySet
An inverse of requires
, where x is in a.required_by() iff x.requires() == a
Trait Implementations§
source§impl Arbitrary for Ability
impl Arbitrary for Ability
§type Parameters = ()
type Parameters = ()
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = TupleUnion<((u32, Arc<fn() -> Ability>), (u32, Arc<fn() -> Ability>), (u32, Arc<fn() -> Ability>), (u32, Arc<fn() -> Ability>))>
type Strategy = TupleUnion<((u32, Arc<fn() -> Ability>), (u32, Arc<fn() -> Ability>), (u32, Arc<fn() -> Ability>), (u32, Arc<fn() -> Ability>))>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
source§impl BitOr<Ability> for AbilitySet
impl BitOr<Ability> for AbilitySet
source§impl Ord for Ability
impl Ord for Ability
source§impl PartialEq<Ability> for Ability
impl PartialEq<Ability> for Ability
source§impl PartialOrd<Ability> for Ability
impl PartialOrd<Ability> for Ability
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more