pub struct VMCodeMetadata(/* private fields */);
Implementations§
Source§impl CodeMetadata
impl CodeMetadata
pub const DEFAULT: CodeMetadata
pub const UPGRADEABLE: CodeMetadata
pub const READABLE: CodeMetadata
pub const PAYABLE: CodeMetadata
pub const PAYABLE_BY_SC: CodeMetadata
Source§impl CodeMetadata
impl CodeMetadata
Sourcepub const fn empty() -> CodeMetadata
pub const fn empty() -> CodeMetadata
Get a flags value with all bits unset.
Sourcepub const fn all() -> CodeMetadata
pub const fn all() -> CodeMetadata
Get a flags value with all known bits set.
Sourcepub const fn bits(&self) -> u16
pub const fn bits(&self) -> u16
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u16) -> Option<CodeMetadata>
pub const fn from_bits(bits: u16) -> Option<CodeMetadata>
Convert from a bits value.
This method will return None
if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u16) -> CodeMetadata
pub const fn from_bits_truncate(bits: u16) -> CodeMetadata
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u16) -> CodeMetadata
pub const fn from_bits_retain(bits: u16) -> CodeMetadata
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<CodeMetadata>
pub fn from_name(name: &str) -> Option<CodeMetadata>
Get a flags value with the bits of a flag with the given name set.
This method will return None
if name
is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: CodeMetadata) -> bool
pub const fn intersects(&self, other: CodeMetadata) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
Sourcepub const fn contains(&self, other: CodeMetadata) -> bool
pub const fn contains(&self, other: CodeMetadata) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
Sourcepub fn insert(&mut self, other: CodeMetadata)
pub fn insert(&mut self, other: CodeMetadata)
The bitwise or (|
) of the bits in two flags values.
Sourcepub fn remove(&mut self, other: CodeMetadata)
pub fn remove(&mut self, other: CodeMetadata)
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
remove
won’t truncate other
, but the !
operator will.
Sourcepub fn toggle(&mut self, other: CodeMetadata)
pub fn toggle(&mut self, other: CodeMetadata)
The bitwise exclusive-or (^
) of the bits in two flags values.
Sourcepub fn set(&mut self, other: CodeMetadata, value: bool)
pub fn set(&mut self, other: CodeMetadata, value: bool)
Call insert
when value
is true
or remove
when value
is false
.
Sourcepub const fn intersection(self, other: CodeMetadata) -> CodeMetadata
pub const fn intersection(self, other: CodeMetadata) -> CodeMetadata
The bitwise and (&
) of the bits in two flags values.
Sourcepub const fn union(self, other: CodeMetadata) -> CodeMetadata
pub const fn union(self, other: CodeMetadata) -> CodeMetadata
The bitwise or (|
) of the bits in two flags values.
Sourcepub const fn difference(self, other: CodeMetadata) -> CodeMetadata
pub const fn difference(self, other: CodeMetadata) -> CodeMetadata
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
Sourcepub const fn symmetric_difference(self, other: CodeMetadata) -> CodeMetadata
pub const fn symmetric_difference(self, other: CodeMetadata) -> CodeMetadata
The bitwise exclusive-or (^
) of the bits in two flags values.
Sourcepub const fn complement(self) -> CodeMetadata
pub const fn complement(self) -> CodeMetadata
The bitwise negation (!
) of the bits in a flags value, truncating the result.
Source§impl CodeMetadata
impl CodeMetadata
Sourcepub const fn iter(&self) -> Iter<CodeMetadata>
pub const fn iter(&self) -> Iter<CodeMetadata>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<CodeMetadata>
pub const fn iter_names(&self) -> IterNames<CodeMetadata>
Yield a set of contained named flags values.
This method is like iter
, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Source§impl CodeMetadata
impl CodeMetadata
pub fn is_upgradeable(&self) -> bool
pub fn is_payable(&self) -> bool
pub fn is_payable_by_sc(&self) -> bool
pub fn is_readable(&self) -> bool
pub fn to_byte_array(&self) -> [u8; 2]
pub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn for_each_string_token<F>(&self, f: F)
Trait Implementations§
Source§impl Binary for CodeMetadata
impl Binary for CodeMetadata
Source§impl BitAnd for CodeMetadata
impl BitAnd for CodeMetadata
Source§fn bitand(self, other: CodeMetadata) -> CodeMetadata
fn bitand(self, other: CodeMetadata) -> CodeMetadata
The bitwise and (&
) of the bits in two flags values.
Source§type Output = CodeMetadata
type Output = CodeMetadata
&
operator.Source§impl BitAndAssign for CodeMetadata
impl BitAndAssign for CodeMetadata
Source§fn bitand_assign(&mut self, other: CodeMetadata)
fn bitand_assign(&mut self, other: CodeMetadata)
The bitwise and (&
) of the bits in two flags values.
Source§impl BitOr for CodeMetadata
impl BitOr for CodeMetadata
Source§fn bitor(self, other: CodeMetadata) -> CodeMetadata
fn bitor(self, other: CodeMetadata) -> CodeMetadata
The bitwise or (|
) of the bits in two flags values.
Source§type Output = CodeMetadata
type Output = CodeMetadata
|
operator.Source§impl BitOrAssign for CodeMetadata
impl BitOrAssign for CodeMetadata
Source§fn bitor_assign(&mut self, other: CodeMetadata)
fn bitor_assign(&mut self, other: CodeMetadata)
The bitwise or (|
) of the bits in two flags values.
Source§impl BitXor for CodeMetadata
impl BitXor for CodeMetadata
Source§fn bitxor(self, other: CodeMetadata) -> CodeMetadata
fn bitxor(self, other: CodeMetadata) -> CodeMetadata
The bitwise exclusive-or (^
) of the bits in two flags values.
Source§type Output = CodeMetadata
type Output = CodeMetadata
^
operator.Source§impl BitXorAssign for CodeMetadata
impl BitXorAssign for CodeMetadata
Source§fn bitxor_assign(&mut self, other: CodeMetadata)
fn bitxor_assign(&mut self, other: CodeMetadata)
The bitwise exclusive-or (^
) of the bits in two flags values.
Source§impl Clone for CodeMetadata
impl Clone for CodeMetadata
Source§fn clone(&self) -> CodeMetadata
fn clone(&self) -> CodeMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CodeMetadata
impl Debug for CodeMetadata
Source§impl Default for CodeMetadata
impl Default for CodeMetadata
Source§fn default() -> CodeMetadata
fn default() -> CodeMetadata
Source§impl Extend<CodeMetadata> for CodeMetadata
impl Extend<CodeMetadata> for CodeMetadata
Source§fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = CodeMetadata>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = CodeMetadata>,
The bitwise or (|
) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Source§impl Flags for CodeMetadata
impl Flags for CodeMetadata
Source§const FLAGS: &'static [Flag<CodeMetadata>]
const FLAGS: &'static [Flag<CodeMetadata>]
Source§fn from_bits_retain(bits: u16) -> CodeMetadata
fn from_bits_retain(bits: u16) -> CodeMetadata
Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|
) of the bits in two flags values.Source§fn remove(&mut self, other: Self)where
Self: Sized,
fn remove(&mut self, other: Self)where
Self: Sized,
&!
). Read moreSource§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^
) of the bits in two flags values.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&
) of the bits in two flags values.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
&!
). Read moreSource§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^
) of the bits in two flags values.Source§fn complement(self) -> Self
fn complement(self) -> Self
!
) of the bits in a flags value, truncating the result.Source§impl From<&[u8]> for CodeMetadata
impl From<&[u8]> for CodeMetadata
Source§fn from(slice: &[u8]) -> CodeMetadata
fn from(slice: &[u8]) -> CodeMetadata
Source§impl From<u16> for CodeMetadata
impl From<u16> for CodeMetadata
Source§fn from(value: u16) -> CodeMetadata
fn from(value: u16) -> CodeMetadata
Source§impl FromIterator<CodeMetadata> for CodeMetadata
impl FromIterator<CodeMetadata> for CodeMetadata
Source§fn from_iter<T>(iterator: T) -> CodeMetadatawhere
T: IntoIterator<Item = CodeMetadata>,
fn from_iter<T>(iterator: T) -> CodeMetadatawhere
T: IntoIterator<Item = CodeMetadata>,
The bitwise or (|
) of the bits in each flags value.
Source§impl IntoIterator for CodeMetadata
impl IntoIterator for CodeMetadata
Source§type Item = CodeMetadata
type Item = CodeMetadata
Source§type IntoIter = Iter<CodeMetadata>
type IntoIter = Iter<CodeMetadata>
Source§fn into_iter(self) -> <CodeMetadata as IntoIterator>::IntoIter
fn into_iter(self) -> <CodeMetadata as IntoIterator>::IntoIter
Source§impl LowerHex for CodeMetadata
impl LowerHex for CodeMetadata
Source§impl NestedDecode for CodeMetadata
impl NestedDecode for CodeMetadata
Source§fn dep_decode_or_handle_err<I, H>(
input: &mut I,
h: H,
) -> Result<CodeMetadata, <H as DecodeErrorHandler>::HandledErr>where
I: NestedDecodeInput,
H: DecodeErrorHandler,
fn dep_decode_or_handle_err<I, H>(
input: &mut I,
h: H,
) -> Result<CodeMetadata, <H as DecodeErrorHandler>::HandledErr>where
I: NestedDecodeInput,
H: DecodeErrorHandler,
dep_decode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn dep_decode<I>(input: &mut I) -> Result<Self, DecodeError>where
I: NestedDecodeInput,
fn dep_decode<I>(input: &mut I) -> Result<Self, DecodeError>where
I: NestedDecodeInput,
Source§impl NestedEncode for CodeMetadata
impl NestedEncode for CodeMetadata
Source§fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
fn dep_encode_or_handle_err<O, H>(
&self,
dest: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: NestedEncodeOutput,
H: EncodeErrorHandler,
dep_encode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn dep_encode<O>(&self, dest: &mut O) -> Result<(), EncodeError>where
O: NestedEncodeOutput,
fn dep_encode<O>(&self, dest: &mut O) -> Result<(), EncodeError>where
O: NestedEncodeOutput,
Source§impl Not for CodeMetadata
impl Not for CodeMetadata
Source§fn not(self) -> CodeMetadata
fn not(self) -> CodeMetadata
The bitwise negation (!
) of the bits in a flags value, truncating the result.
Source§type Output = CodeMetadata
type Output = CodeMetadata
!
operator.Source§impl Octal for CodeMetadata
impl Octal for CodeMetadata
Source§impl PartialEq for CodeMetadata
impl PartialEq for CodeMetadata
Source§impl Sub for CodeMetadata
impl Sub for CodeMetadata
Source§fn sub(self, other: CodeMetadata) -> CodeMetadata
fn sub(self, other: CodeMetadata) -> CodeMetadata
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
Source§type Output = CodeMetadata
type Output = CodeMetadata
-
operator.Source§impl SubAssign for CodeMetadata
impl SubAssign for CodeMetadata
Source§fn sub_assign(&mut self, other: CodeMetadata)
fn sub_assign(&mut self, other: CodeMetadata)
The intersection of a source flags value with the complement of a target flags value (&!
).
This method is not equivalent to self & !other
when other
has unknown bits set.
difference
won’t truncate other
, but the !
operator will.
Source§impl TopDecode for CodeMetadata
impl TopDecode for CodeMetadata
Source§fn top_decode_or_handle_err<I, H>(
input: I,
h: H,
) -> Result<CodeMetadata, <H as DecodeErrorHandler>::HandledErr>where
I: TopDecodeInput,
H: DecodeErrorHandler,
fn top_decode_or_handle_err<I, H>(
input: I,
h: H,
) -> Result<CodeMetadata, <H as DecodeErrorHandler>::HandledErr>where
I: TopDecodeInput,
H: DecodeErrorHandler,
top_decode
that can handle errors as soon as they occur.
For instance it can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn top_decode<I>(input: I) -> Result<Self, DecodeError>where
I: TopDecodeInput,
fn top_decode<I>(input: I) -> Result<Self, DecodeError>where
I: TopDecodeInput,
Source§impl TopEncode for CodeMetadata
impl TopEncode for CodeMetadata
Source§fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
fn top_encode_or_handle_err<O, H>(
&self,
output: O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeOutput,
H: EncodeErrorHandler,
top_encode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>where
O: TopEncodeOutput,
Source§impl UpperHex for CodeMetadata
impl UpperHex for CodeMetadata
impl Copy for CodeMetadata
impl StructuralPartialEq for CodeMetadata
Auto Trait Implementations§
impl Freeze for CodeMetadata
impl RefUnwindSafe for CodeMetadata
impl Send for CodeMetadata
impl Sync for CodeMetadata
impl Unpin for CodeMetadata
impl UnwindSafe for CodeMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> TopDecodeMulti for Twhere
T: TopDecode,
impl<T> TopDecodeMulti for Twhere
T: TopDecode,
Source§const IS_SINGLE_VALUE: bool = true
const IS_SINGLE_VALUE: bool = true
fn multi_decode_or_handle_err<I, H>(
input: &mut I,
h: H,
) -> Result<T, <H as DecodeErrorHandler>::HandledErr>where
I: TopDecodeMultiInput,
H: DecodeErrorHandler,
fn multi_decode<I>(input: &mut I) -> Result<Self, DecodeError>where
I: TopDecodeMultiInput,
Source§impl<T> TopDecodeMultiLength for T
impl<T> TopDecodeMultiLength for T
Source§impl<T> TopEncodeMulti for Twhere
T: TopEncode,
impl<T> TopEncodeMulti for Twhere
T: TopEncode,
Source§fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
top_encode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.