pub struct ThreadPriorityValue(/* private fields */);
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);
Implementations§
Trait Implementations§
Source§impl Clone for ThreadPriorityValue
impl Clone for ThreadPriorityValue
Source§fn clone(&self) -> ThreadPriorityValue
fn clone(&self) -> ThreadPriorityValue
Returns a copy 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 ThreadPriorityValue
impl Debug for ThreadPriorityValue
Source§impl Default for ThreadPriorityValue
impl Default for ThreadPriorityValue
Source§fn default() -> ThreadPriorityValue
fn default() -> ThreadPriorityValue
Returns the “default value” for a type. Read more
Source§impl Hash for ThreadPriorityValue
impl Hash for ThreadPriorityValue
Source§impl Into<u8> for ThreadPriorityValue
impl Into<u8> for ThreadPriorityValue
Source§impl Ord for ThreadPriorityValue
impl Ord for ThreadPriorityValue
Source§fn cmp(&self, other: &ThreadPriorityValue) -> Ordering
fn cmp(&self, other: &ThreadPriorityValue) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ThreadPriorityValue
impl PartialEq for ThreadPriorityValue
Source§impl PartialOrd for ThreadPriorityValue
impl PartialOrd for ThreadPriorityValue
Source§impl TryFrom<u8> for ThreadPriorityValue
impl TryFrom<u8> for ThreadPriorityValue
impl Copy for ThreadPriorityValue
impl Eq for ThreadPriorityValue
impl StructuralPartialEq for ThreadPriorityValue
Auto Trait Implementations§
impl Freeze for ThreadPriorityValue
impl RefUnwindSafe for ThreadPriorityValue
impl Send for ThreadPriorityValue
impl Sync for ThreadPriorityValue
impl Unpin for ThreadPriorityValue
impl UnwindSafe for ThreadPriorityValue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)