Struct thread_priority::ThreadPriorityValue
source · [−]pub struct ThreadPriorityValue(_);
Expand description
Platform-independent thread priority value.
Should be in [0; 100)
range. The higher the number is - the higher
the priority.
The only way to create such a value is a safe conversion from an 8-byte
unsigned integer (u8
):
use thread_priority::*;
use std::convert::{TryFrom, TryInto};
// Create the lowest possible priority value.
assert!(ThreadPriorityValue::try_from(0u8).is_ok());
// Create it implicitly via `TryInto`:
let _priority = ThreadPriority::Crossplatform(0u8.try_into().unwrap());
In case you need to get the raw value out of it, use the Into<u8>
trait:
use thread_priority::*;
use std::convert::TryFrom;
// Create the lowest possible priority value.
let priority = ThreadPriorityValue::try_from(0u8).unwrap();
// Create it implicitly via `TryInto`:
let raw_value: u8 = priority.into();
assert_eq!(raw_value, 0);
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for ThreadPriorityValue
impl Send for ThreadPriorityValue
impl Sync for ThreadPriorityValue
impl Unpin for ThreadPriorityValue
impl UnwindSafe for ThreadPriorityValue
Blanket Implementations
Mutably borrows from an owned value. Read more