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);Implementations
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 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl 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
sourcefn cmp(&self, other: &ThreadPriorityValue) -> Ordering
fn cmp(&self, other: &ThreadPriorityValue) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Selfwhere
Self: Sized,
const fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Selfwhere
Self: Sized,
const fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<ThreadPriorityValue> for ThreadPriorityValue
impl PartialEq<ThreadPriorityValue> for ThreadPriorityValue
sourcefn eq(&self, other: &ThreadPriorityValue) -> bool
fn eq(&self, other: &ThreadPriorityValue) -> bool
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>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const 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 moresourceimpl 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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