Struct cranelift_codegen::ir::jumptable::JumpTableData
source · pub struct JumpTableData { /* private fields */ }
Expand description
Contents of a jump table.
All jump tables use 0-based indexing and are densely populated.
The default block for the jump table is stored as the first element of the underlying vector.
It can be accessed through the default_block
and default_block_mut
functions. All blocks
may be iterated using the all_branches
and all_branches_mut
functions, which will both
iterate over the default block first.
Implementations§
source§impl JumpTableData
impl JumpTableData
sourcepub fn new(def: BlockCall, table: &[BlockCall]) -> Self
pub fn new(def: BlockCall, table: &[BlockCall]) -> Self
Create a new jump table with the provided blocks.
sourcepub fn default_block(&self) -> BlockCall
pub fn default_block(&self) -> BlockCall
Fetch the default block for this jump table.
sourcepub fn default_block_mut(&mut self) -> &mut BlockCall
pub fn default_block_mut(&mut self) -> &mut BlockCall
Mutable access to the default block of this jump table.
sourcepub fn all_branches(&self) -> &[BlockCall]
pub fn all_branches(&self) -> &[BlockCall]
The jump table and default block as a single slice. The default block will always be first.
sourcepub fn all_branches_mut(&mut self) -> &mut [BlockCall]
pub fn all_branches_mut(&mut self) -> &mut [BlockCall]
The jump table and default block as a single mutable slice. The default block will always be first.
sourcepub fn as_slice(&self) -> &[BlockCall]
pub fn as_slice(&self) -> &[BlockCall]
Access the jump table as a slice. This excludes the default block.
sourcepub fn as_mut_slice(&mut self) -> &mut [BlockCall]
pub fn as_mut_slice(&mut self) -> &mut [BlockCall]
Access the jump table as a mutable slice. This excludes the default block.
sourcepub fn iter(&self) -> Iter<'_, BlockCall>
👎Deprecated since 7.0.0: please use .as_slice()
instead
pub fn iter(&self) -> Iter<'_, BlockCall>
.as_slice()
insteadReturns an iterator to the jump table, excluding the default block.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, BlockCall>
👎Deprecated since 7.0.0: please use .as_mut_slice()
instead
pub fn iter_mut(&mut self) -> IterMut<'_, BlockCall>
.as_mut_slice()
insteadReturns an iterator that allows modifying each value, excluding the default block.
sourcepub fn display<'a>(&'a self, pool: &'a ValueListPool) -> DisplayJumpTable<'a>
pub fn display<'a>(&'a self, pool: &'a ValueListPool) -> DisplayJumpTable<'a>
Return a value that can display the contents of this jump table.
Trait Implementations§
source§impl Clone for JumpTableData
impl Clone for JumpTableData
source§fn clone(&self) -> JumpTableData
fn clone(&self) -> JumpTableData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Hash for JumpTableData
impl Hash for JumpTableData
source§impl PartialEq for JumpTableData
impl PartialEq for JumpTableData
source§fn eq(&self, other: &JumpTableData) -> bool
fn eq(&self, other: &JumpTableData) -> bool
self
and other
values to be equal, and is used
by ==
.