Struct furiosa_device::EnvBuilder
source · pub struct EnvBuilder<T> { /* private fields */ }
Expand description
A struct for building DeviceConfig
from an environment variable.
Implementations§
source§impl EnvBuilder<NotDetermined>
impl EnvBuilder<NotDetermined>
sourcepub fn or_env<K: ToString>(self, key: K) -> Self
pub fn or_env<K: ToString>(self, key: K) -> Self
Provides a fallback env variable to the builder when the previous options are empty.
sourcepub fn or_try<T: ToString>(self, item: Option<T>) -> Self
pub fn or_try<T: ToString>(self, item: Option<T>) -> Self
Provides a fallback option to the builder when the previous options are empty.
The builder will try from_str()
method if the item is Some
.
sourcepub fn or(self, fallback: DeviceConfig) -> EnvBuilder<DeviceConfig>
pub fn or(self, fallback: DeviceConfig) -> EnvBuilder<DeviceConfig>
Provides a fallback config to the builder when the previous options are empty. Note that incorrect syntax causes the build to fail rather than fallback.
sourcepub fn or_default(self) -> EnvBuilder<DeviceConfig>
pub fn or_default(self) -> EnvBuilder<DeviceConfig>
Provides a fallback default config to the builder when the previous options are empty. Note that incorrect syntax causes the build to fail rather than fallback.
source§impl<T: TryInto<DeviceConfig, Error: Into<DeviceError>>> EnvBuilder<T>
impl<T: TryInto<DeviceConfig, Error: Into<DeviceError>>> EnvBuilder<T>
sourcepub fn build(self) -> DeviceResult<DeviceConfig>
pub fn build(self) -> DeviceResult<DeviceConfig>
Finalize the config.
Trait Implementations§
source§impl<T: Clone> Clone for EnvBuilder<T>
impl<T: Clone> Clone for EnvBuilder<T>
source§fn clone(&self) -> EnvBuilder<T>
fn clone(&self) -> EnvBuilder<T>
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 moreAuto Trait Implementations§
impl<T> RefUnwindSafe for EnvBuilder<T>where T: RefUnwindSafe,
impl<T> Send for EnvBuilder<T>where T: Send,
impl<T> Sync for EnvBuilder<T>where T: Sync,
impl<T> Unpin for EnvBuilder<T>where T: Unpin,
impl<T> UnwindSafe for EnvBuilder<T>where T: UnwindSafe,
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