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
sourceimpl Clone for ThreadPriorityValue
impl Clone for ThreadPriorityValue
sourcefn clone(&self) -> ThreadPriorityValue
fn clone(&self) -> ThreadPriorityValue
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for ThreadPriorityValue
impl Debug for ThreadPriorityValue
sourceimpl Default for ThreadPriorityValue
impl Default for ThreadPriorityValue
sourcefn default() -> ThreadPriorityValue
fn default() -> ThreadPriorityValue
Returns the “default value” for a type. Read more
sourceimpl Hash for ThreadPriorityValue
impl Hash for ThreadPriorityValue
sourceimpl Into<u8> for ThreadPriorityValue
impl Into<u8> for ThreadPriorityValue
sourceimpl Ord for ThreadPriorityValue
impl Ord for ThreadPriorityValue
sourceimpl PartialEq<ThreadPriorityValue> for ThreadPriorityValue
impl PartialEq<ThreadPriorityValue> for ThreadPriorityValue
sourcefn eq(&self, other: &ThreadPriorityValue) -> bool
fn eq(&self, other: &ThreadPriorityValue) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &ThreadPriorityValue) -> bool
fn ne(&self, other: &ThreadPriorityValue) -> bool
This method tests for !=.
sourceimpl PartialOrd<ThreadPriorityValue> for ThreadPriorityValue
impl PartialOrd<ThreadPriorityValue> for ThreadPriorityValue
sourcefn partial_cmp(&self, other: &ThreadPriorityValue) -> Option<Ordering>
fn partial_cmp(&self, other: &ThreadPriorityValue) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl TryFrom<u8> for ThreadPriorityValue
impl TryFrom<u8> for ThreadPriorityValue
impl Copy for ThreadPriorityValue
impl Eq for ThreadPriorityValue
impl StructuralEq for ThreadPriorityValue
impl StructuralPartialEq for ThreadPriorityValue
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more