#[repr(u8)]pub enum OsalRsBool {
False = 1,
True = 0,
}Expand description
Boolean type compatible with RTOS return values.
Many RTOS functions return 0 for success and non-zero for failure. This type provides a Rust-idiomatic way to work with such values.
§Examples
ⓘ
use osal_rs::os::{Semaphore, SemaphoreFn};
use osal_rs::utils::OsalRsBool;
use core::time::Duration;
let sem = Semaphore::new(1, 1).unwrap();
match sem.wait(Duration::from_millis(100)) {
OsalRsBool::True => println!("Acquired semaphore"),
OsalRsBool::False => println!("Failed to acquire"),
}
// Can also convert to bool
if sem.signal().into() {
println!("Semaphore signaled");
}Variants§
Trait Implementations§
Source§impl Clone for OsalRsBool
impl Clone for OsalRsBool
Source§fn clone(&self) -> OsalRsBool
fn clone(&self) -> OsalRsBool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OsalRsBool
impl Debug for OsalRsBool
Source§impl PartialEq for OsalRsBool
impl PartialEq for OsalRsBool
impl Copy for OsalRsBool
impl Eq for OsalRsBool
impl StructuralPartialEq for OsalRsBool
Auto Trait Implementations§
impl Freeze for OsalRsBool
impl RefUnwindSafe for OsalRsBool
impl Send for OsalRsBool
impl Sync for OsalRsBool
impl Unpin for OsalRsBool
impl UnwindSafe for OsalRsBool
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