pub struct DevicePolicy { /* private fields */ }Expand description
Which backends a process may use — intersected with compile-time features and runtime availability.
Implementations§
Source§impl DevicePolicy
impl DevicePolicy
Sourcepub fn only(devices: impl IntoIterator<Item = Device>) -> Self
pub fn only(devices: impl IntoIterator<Item = Device>) -> Self
Restrict to an explicit backend set the developer ships.
Sourcepub fn with_deny(self, devices: impl IntoIterator<Item = Device>) -> Self
pub fn with_deny(self, devices: impl IntoIterator<Item = Device>) -> Self
Exclude specific backends from consideration.
Sourcepub fn with_prefer(self, devices: impl IntoIterator<Item = Device>) -> Self
pub fn with_prefer(self, devices: impl IntoIterator<Item = Device>) -> Self
Prefer these backends when cost models tie or are unavailable.
Sourcepub fn with_benchmark_pick(self, runs: usize) -> Self
pub fn with_benchmark_pick(self, runs: usize) -> Self
Pick the fastest backend via a one-time micro-benchmark (needs inputs at resolve time).
pub fn pick_strategy(&self) -> DevicePickStrategy
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Read policy from process env (see Self::from_env_key).
Sourcepub fn from_env_key(prefix: &str) -> Self
pub fn from_env_key(prefix: &str) -> Self
Read PREFIX_DEVICES, PREFIX_DENY_DEVICES, PREFIX_PREFER_DEVICES.
Trait Implementations§
Source§impl Clone for DevicePolicy
impl Clone for DevicePolicy
Source§fn clone(&self) -> DevicePolicy
fn clone(&self) -> DevicePolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DevicePolicy
impl Debug for DevicePolicy
Source§impl Default for DevicePolicy
impl Default for DevicePolicy
Source§fn default() -> DevicePolicy
fn default() -> DevicePolicy
Returns the “default value” for a type. Read more
impl Eq for DevicePolicy
Source§impl PartialEq for DevicePolicy
impl PartialEq for DevicePolicy
Source§fn eq(&self, other: &DevicePolicy) -> bool
fn eq(&self, other: &DevicePolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DevicePolicy
Auto Trait Implementations§
impl Freeze for DevicePolicy
impl RefUnwindSafe for DevicePolicy
impl Send for DevicePolicy
impl Sync for DevicePolicy
impl Unpin for DevicePolicy
impl UnsafeUnpin for DevicePolicy
impl UnwindSafe for DevicePolicy
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more