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

source

pub fn new() -> Self

Creates a new breakpoint list.

source

pub fn get(&self, id: u32) -> Option<&Breakpoint>

Gets an immutable reference to breakpoint with a given ID, returning None if it was already removed.

source

pub fn get_mut(&mut self, id: u32) -> Option<&mut Breakpoint>

Gets a mutable reference to breakpoint with a given ID, returning None if it was already removed.

source

pub fn contains_key(&self, id: u32) -> bool

Checks if the ID is currently associated with some breakpoint.

source

pub fn len(&self) -> usize

Counts the number of defined breakpoints.

source

pub fn is_empty(&self) -> bool

Checks if the breakpoint list is empty.

source

pub fn insert(&mut self, bpt: Breakpoint) -> u32

Inserts a breakpoint into the list and returns its key.

This panics if another breakpoint is added while 2^32 breakpoints are currently active.

source

pub fn remove(&mut self, key: u32) -> Option<Breakpoint>

Remove breakpoint with a given ID.

If no breakpoint is present with this ID, this returns None.

source

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.

source

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.

source

pub fn clear(&mut self)

Removes all breakpoints from the list.

source

pub fn iter(&self) -> impl Iterator<Item = (u32, &Breakpoint)>

An iterator visiting all breakpoints and their associated IDs in arbitrary order.

source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (u32, &mut Breakpoint)>

An iterator visiting all breakpoints and their associated IDs in arbitrary order, with a mutable reference to each breakpoint.

source

pub fn keys(&self) -> impl Iterator<Item = u32> + '_

An iterator visiting all IDs in arbitrary order.

source

pub fn values(&self) -> Values<'_, u32, Breakpoint>

An iterator visiting all breakpoints in arbitrary order.

source

pub fn values_mut(&mut self) -> ValuesMut<'_, u32, Breakpoint>

An iterator visiting all breakpoints in arbitrary order, with a mutable reference to each breakpoint.

Trait Implementations§

source§

impl Debug for BreakpointList

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BreakpointList

source§

fn default() -> BreakpointList

Returns the “default value” for a type. Read more
source§

impl Index<u32> for BreakpointList

§

type Output = Breakpoint

The returned type after indexing.
source§

fn index(&self, index: u32) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<u32> for BreakpointList

source§

fn index_mut(&mut self, index: u32) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V