pub enum Exit<T = Expr> {
Terminate,
FallThrough(usize),
Unconditional(T),
Branch {
condition: T,
when_true: T,
when_false: usize,
},
}Expand description
Possible ways for an AnnotatedBlock to exit.
Variants§
Terminate
Unconditional program halt.
Includes stop (0x00), return (0xF3), revert (0xfd), etc.
FallThrough(usize)
Unconditionally continue to the subsequent block, which has the given offset.
Commonly occurs when the next block begins with a jumpdest (0x5b).
Unconditional(T)
Unconditionally jump to the given offset.
Branch
Conditionally jump to one of the given offsets.
Implementations§
Source§impl<T> Exit<T>
impl<T> Exit<T>
Sourcepub fn fall_through(&self) -> Option<usize>
pub fn fall_through(&self) -> Option<usize>
Get the offset of the fall through block, or None if this block can
never fall through.
Both Exit::FallThrough and Exit::Branch have fall through
offsets.
Sourcepub fn is_fall_through(&self) -> bool
pub fn is_fall_through(&self) -> bool
Return true if this block is an Exit::FallThrough, or false
otherwise.
Sourcepub fn is_terminate(&self) -> bool
pub fn is_terminate(&self) -> bool
Return true if this block is an Exit::Terminate, or false
otherwise.
Sourcepub fn is_unconditional(&self) -> bool
pub fn is_unconditional(&self) -> bool
Return true if this block is an Exit::Unconditional, or false
otherwise.
Sourcepub fn is_branch(&self) -> bool
pub fn is_branch(&self) -> bool
Return true if this block is an Exit::Branch, or false
otherwise.