Struct lc3_ensemble::sim::debug::BreakpointList
source · pub struct BreakpointList { /* private fields */ }Expand description
A list of breakpoints.
This works similarly to GDB breakpoints, in that creating a breakpoint gives you an ID which you can use to query or remove the breakpoint later.
Implementations§
source§impl BreakpointList
impl BreakpointList
sourcepub fn get(&self, key: BreakpointKey) -> Option<&Breakpoint>
pub fn get(&self, key: BreakpointKey) -> Option<&Breakpoint>
Gets an immutable reference to breakpoint with a given key, returning None if it was already removed.
sourcepub fn get_mut(&mut self, key: BreakpointKey) -> Option<&mut Breakpoint>
pub fn get_mut(&mut self, key: BreakpointKey) -> Option<&mut Breakpoint>
Gets a mutable reference to breakpoint with a given key, returning None if it was already removed.
sourcepub fn contains_key(&self, key: BreakpointKey) -> bool
pub fn contains_key(&self, key: BreakpointKey) -> bool
Checks if the key is currently associated with some breakpoint.
sourcepub fn insert(&mut self, bpt: Breakpoint) -> BreakpointKey
pub fn insert(&mut self, bpt: Breakpoint) -> BreakpointKey
Inserts a breakpoint into the list and returns its key.
sourcepub fn remove(&mut self, key: BreakpointKey) -> Option<Breakpoint>
pub fn remove(&mut self, key: BreakpointKey) -> Option<Breakpoint>
Remove breakpoint with given key.
If breakpoint was previously removed, then this returns None.
sourcepub fn remove_breakpoint(
&mut self,
breakpoint: &Breakpoint
) -> Option<Breakpoint>
pub fn remove_breakpoint( &mut self, breakpoint: &Breakpoint ) -> Option<Breakpoint>
Remove breakpoint that matches a given value.
This is a utility function to remove a breakpoint by value.
If you’d like to remove by key, use BreakpointList::remove.
Note that this can only reliably remove PC, Reg, and Mem breakpoints. The remaining 3 may fail to match even if an identical breakpoint appears in the list.
sourcepub fn remove_breakpoint_by(
&mut self,
pred: impl FnMut(&mut Breakpoint) -> bool
) -> Option<Breakpoint>
pub fn remove_breakpoint_by( &mut self, pred: impl FnMut(&mut Breakpoint) -> bool ) -> Option<Breakpoint>
Remove breakpoint that matches a given predicate.
This is a utility function to remove a breakpoint by value.
If you’d like to remove by key, use BreakpointList::remove.
sourcepub fn iter(&self) -> Iter<'_, BreakpointKey, Breakpoint>
pub fn iter(&self) -> Iter<'_, BreakpointKey, Breakpoint>
An iterator visiting all breakpoints and their associated keys in arbitrary order.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
sourcepub fn iter_mut(&mut self) -> IterMut<'_, BreakpointKey, Breakpoint>
pub fn iter_mut(&mut self) -> IterMut<'_, BreakpointKey, Breakpoint>
An iterator visiting all breakpoints and their associated keys in arbitrary order, with a mutable reference to each breakpoint.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
sourcepub fn keys(&self) -> Keys<'_, BreakpointKey, Breakpoint>
pub fn keys(&self) -> Keys<'_, BreakpointKey, Breakpoint>
An iterator visiting all keys in arbitrary order.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
sourcepub fn values(&self) -> Values<'_, BreakpointKey, Breakpoint>
pub fn values(&self) -> Values<'_, BreakpointKey, Breakpoint>
An iterator visiting all breakpoints in arbitrary order.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.
sourcepub fn values_mut(&mut self) -> ValuesMut<'_, BreakpointKey, Breakpoint>
pub fn values_mut(&mut self) -> ValuesMut<'_, BreakpointKey, Breakpoint>
An iterator visiting all breakpoints in arbitrary order, with a mutable reference to each breakpoint.
This function must iterate over all slots, empty or not. In the face of many deleted elements it can be inefficient.