pub struct Arena<S, C> { /* private fields */ }
Implementations§
Source§impl<S, C> Arena<S, C>
impl<S, C> Arena<S, C>
Sourcepub fn check(&self) -> Result<(), OffendingIds>
pub fn check(&self) -> Result<(), OffendingIds>
Use this method to re-check all references in the Arena
after
modifications via Arena::bbs_mut
.
Sourcepub fn push(
&mut self,
bb: BasicBlock<S, C, BbId>,
) -> Result<usize, (BasicBlock<S, C, BbId>, OffendingIds)>
pub fn push( &mut self, bb: BasicBlock<S, C, BbId>, ) -> Result<usize, (BasicBlock<S, C, BbId>, OffendingIds)>
Returns the ID of the newly appended BB if successful, or $bb & the invalid BbIds.
Sourcepub fn remove(
&mut self,
bbid: BbId,
) -> Option<Result<(BasicBlock<S, C, BbId>, Vec<String>), OffendingIds>>
pub fn remove( &mut self, bbid: BbId, ) -> Option<Result<(BasicBlock<S, C, BbId>, Vec<String>), OffendingIds>>
Removes a BB, fails if any references to it exist. If successful, returns the removed BB and all labels which referenced it. Otherwise, returns the offending BBs (which still reference it)
Source§impl<S, C> Arena<S, C>
impl<S, C> Arena<S, C>
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn bbs(&self) -> &Map<BbId, BasicBlock<S, C, BbId>>
pub fn bbs_mut(&mut self) -> &mut Map<BbId, BasicBlock<S, C, BbId>>
pub fn labels(&self) -> &BTreeMap<String, BbId>
pub fn labels_of_bb(&self, bbid: BbId) -> impl Iterator<Item = &str>
pub fn label2bb(&self, label: &str) -> Option<(BbId, &BasicBlock<S, C, BbId>)>
Sourcepub fn set_label(
&mut self,
label: Label,
target: BbId,
overwrite: bool,
) -> Result<Option<BbId>, SetBbLabelError>
pub fn set_label( &mut self, label: Label, target: BbId, overwrite: bool, ) -> Result<Option<BbId>, SetBbLabelError>
If this call replaced the current label->BB-ID association, then the old associated BBID is returned.
pub fn shrink_to_fit(&mut self)
Trait Implementations§
Source§impl<S, C> ForeachTarget for Arena<S, C>
impl<S, C> ForeachTarget for Arena<S, C>
type JumpTarget = usize
fn foreach_target<F>(&self, f: F)where
F: FnMut(&Self::JumpTarget),
fn foreach_target_mut<F>(&mut self, f: F)where
F: FnMut(&mut Self::JumpTarget),
Auto Trait Implementations§
impl<S, C> Freeze for Arena<S, C>
impl<S, C> RefUnwindSafe for Arena<S, C>where
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, C> Send for Arena<S, C>
impl<S, C> Sync for Arena<S, C>
impl<S, C> Unpin for Arena<S, C>
impl<S, C> UnwindSafe for Arena<S, C>where
C: RefUnwindSafe,
S: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more