pub struct AppliedPriority { /* private fields */ }Expand description
What a thread-priority request actually produced.
Returned by set_thread_priority and
promote_thread_to_realtime in place
of (). The unit return was a lie by omission: on Linux a “successful”
set_thread_priority(Highest) can mean you got Highest, or that every
privileged path was denied and you silently kept the level you already had
(Normal for a fresh thread). This says which - uniformly across platforms,
so callers never #[cfg].
Branch on Grant / AppliedPriority::degraded / AppliedPriority::reason
/ AppliedPriority::mechanism for logic; use the Display impl for the
human-readable form.
Implementations§
Source§impl AppliedPriority
impl AppliedPriority
Sourcepub fn from_parts(
requested: ThreadPriority,
effective: ThreadPriority,
grant: Grant,
reason: Option<FallbackReason>,
mechanism: Mechanism,
broker_error: Option<BrokerError>,
) -> Option<Self>
pub fn from_parts( requested: ThreadPriority, effective: ThreadPriority, grant: Grant, reason: Option<FallbackReason>, mechanism: Mechanism, broker_error: Option<BrokerError>, ) -> Option<Self>
Rebuilds an outcome from structured data.
Returns None when the parts contradict each other, such as a broker
error without a broker-refused reason.
Sourcepub fn requested(&self) -> ThreadPriority
pub fn requested(&self) -> ThreadPriority
The level the caller requested.
Sourcepub fn effective(&self) -> ThreadPriority
pub fn effective(&self) -> ThreadPriority
The level actually in effect.
Sourcepub fn reason(&self) -> Option<FallbackReason>
pub fn reason(&self) -> Option<FallbackReason>
Why the request fell short, if it did.
Sourcepub fn mechanism(&self) -> Mechanism
pub fn mechanism(&self) -> Mechanism
The concrete OS scheduling mechanism the request landed on.
Sourcepub fn broker_error(&self) -> Option<BrokerError>
pub fn broker_error(&self) -> Option<BrokerError>
The typed reason a broker refused the grant.
Sourcepub fn degraded(&self) -> bool
pub fn degraded(&self) -> bool
true when the request did NOT get a clean grant of exactly what was
asked - a fall back to a weaker level (Highest -> Normal) or a
broker clamp within the level (TimeCritical -> nice -15). Equivalent to
reason.is_some(); the FallbackReason says which.
Trait Implementations§
Source§impl Clone for AppliedPriority
impl Clone for AppliedPriority
Source§fn clone(&self) -> AppliedPriority
fn clone(&self) -> AppliedPriority
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AppliedPriority
impl Debug for AppliedPriority
Source§impl Display for AppliedPriority
impl Display for AppliedPriority
impl Eq for AppliedPriority
Source§impl PartialEq for AppliedPriority
impl PartialEq for AppliedPriority
Source§fn eq(&self, other: &AppliedPriority) -> bool
fn eq(&self, other: &AppliedPriority) -> bool
self and other values to be equal, and is used by ==.