pub struct ConfigBuilder { /* private fields */ }Expand description
Builder, which allows to create a new Config
The first role added will be set as the default role.
This can be changed by calling default_role with the role name.
§Example
use terraphim_config::ConfigBuilder;
let config = ConfigBuilder::new()
.global_shortcut("Ctrl+X")
.with_role("Default", role)
.with_role("Engineer", role)
.with_role("System Operator", role)
.default_role("Default")
.build();Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
pub fn new_with_id(id: ConfigId) -> Self
pub fn build_default_embedded(self) -> Self
pub fn get_default_data_path(&self) -> PathBuf
pub fn build_default_server(self) -> Self
pub fn build_default_desktop(self) -> Self
Sourcepub fn from_config(
config: Config,
device_settings: DeviceSettings,
settings_path: PathBuf,
) -> Self
pub fn from_config( config: Config, device_settings: DeviceSettings, settings_path: PathBuf, ) -> Self
Start from an existing config
This is useful when you want to start from an setup and modify some fields
Sourcepub fn global_shortcut(self, global_shortcut: &str) -> Self
pub fn global_shortcut(self, global_shortcut: &str) -> Self
Set the global shortcut for the config
Sourcepub fn default_role(self, default_role: &str) -> Result<Self>
pub fn default_role(self, default_role: &str) -> Result<Self>
Set the default role for the config
Trait Implementations§
Source§impl Debug for ConfigBuilder
impl Debug for ConfigBuilder
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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