pub struct Counter { /* private fields */ }Expand description
A handle to a cFE generic counter.
The counter can be shared across tasks. The underlying cFE
resource is automatically deleted when the Counter is dropped.
Implementations§
Source§impl Counter
impl Counter
Sourcepub fn new(name: &str) -> Result<Self>
pub fn new(name: &str) -> Result<Self>
Registers a new generic counter with cFE.
The counter is initialized to 0.
§Arguments
name: A unique string to identify the counter.
Sourcepub fn inc(&self) -> Result<()>
pub fn inc(&self) -> Result<()>
Increments the counter’s value by one.
Note: the C header does not guarantee atomicity for this operation.
Sourcepub fn get_id_by_name(name: &str) -> Result<CounterId>
pub fn get_id_by_name(name: &str) -> Result<CounterId>
Gets the cFE ID for a generic counter by its registered name.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Counter
impl RefUnwindSafe for Counter
impl Send for Counter
impl Sync for Counter
impl Unpin for Counter
impl UnsafeUnpin for Counter
impl UnwindSafe for Counter
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