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§
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<ThreadPriorityValue> for ThreadPriorityValue
impl PartialEq<ThreadPriorityValue> for ThreadPriorityValue
source§fn 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 ==
.source§impl PartialOrd<ThreadPriorityValue> for ThreadPriorityValue
impl PartialOrd<ThreadPriorityValue> for ThreadPriorityValue
source§fn partial_cmp(&self, other: &ThreadPriorityValue) -> Option<Ordering>
fn partial_cmp(&self, other: &ThreadPriorityValue) -> Option<Ordering>
1.0.0 · source§fn 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