pub struct UserSettings { /* private fields */ }
Implementations§
Source§impl UserSettings
impl UserSettings
pub const USER_NAME_PLACEHOLDER: &'static str = "(no name configured)"
pub const USER_EMAIL_PLACEHOLDER: &'static str = "(no email configured)"
pub fn from_config(config: StackedConfig) -> Result<Self, ConfigGetError>
Sourcepub fn with_new_config(
&self,
config: StackedConfig,
) -> Result<Self, ConfigGetError>
pub fn with_new_config( &self, config: StackedConfig, ) -> Result<Self, ConfigGetError>
Like UserSettings::from_config()
, but retains the internal state.
This ensures that no duplicated change IDs are generated within the
current process. New debug.randomness-seed
value is ignored.
pub fn get_rng(&self) -> Arc<JJRng>
pub fn user_name(&self) -> &str
pub fn user_email(&self) -> &str
pub fn fsmonitor_settings(&self) -> Result<FsmonitorSettings, ConfigGetError>
pub fn commit_timestamp(&self) -> Option<Timestamp>
pub fn operation_timestamp(&self) -> Option<Timestamp>
pub fn operation_hostname(&self) -> &str
pub fn operation_username(&self) -> &str
pub fn signature(&self) -> Signature
Sourcepub fn config(&self) -> &StackedConfig
pub fn config(&self) -> &StackedConfig
Returns low-level config object.
You should typically use settings.get_<type>()
methods instead.
pub fn git_settings(&self) -> Result<GitSettings, ConfigGetError>
pub fn signing_backend(&self) -> Result<Option<String>, ConfigGetError>
pub fn sign_settings(&self) -> SignSettings
Source§impl UserSettings
General-purpose accessors.
impl UserSettings
General-purpose accessors.
Sourcepub fn get<'de, T: Deserialize<'de>>(
&self,
name: impl ToConfigNamePath,
) -> Result<T, ConfigGetError>
pub fn get<'de, T: Deserialize<'de>>( &self, name: impl ToConfigNamePath, ) -> Result<T, ConfigGetError>
Looks up value of the specified type T
by name
.
Sourcepub fn get_string(
&self,
name: impl ToConfigNamePath,
) -> Result<String, ConfigGetError>
pub fn get_string( &self, name: impl ToConfigNamePath, ) -> Result<String, ConfigGetError>
Looks up string value by name
.
Sourcepub fn get_int(
&self,
name: impl ToConfigNamePath,
) -> Result<i64, ConfigGetError>
pub fn get_int( &self, name: impl ToConfigNamePath, ) -> Result<i64, ConfigGetError>
Looks up integer value by name
.
Sourcepub fn get_bool(
&self,
name: impl ToConfigNamePath,
) -> Result<bool, ConfigGetError>
pub fn get_bool( &self, name: impl ToConfigNamePath, ) -> Result<bool, ConfigGetError>
Looks up boolean value by name
.
Sourcepub fn get_value(
&self,
name: impl ToConfigNamePath,
) -> Result<ConfigValue, ConfigGetError>
pub fn get_value( &self, name: impl ToConfigNamePath, ) -> Result<ConfigValue, ConfigGetError>
Looks up generic value by name
.
Sourcepub fn get_value_with<T, E: Into<Box<dyn Error + Send + Sync>>>(
&self,
name: impl ToConfigNamePath,
convert: impl FnOnce(ConfigValue) -> Result<T, E>,
) -> Result<T, ConfigGetError>
pub fn get_value_with<T, E: Into<Box<dyn Error + Send + Sync>>>( &self, name: impl ToConfigNamePath, convert: impl FnOnce(ConfigValue) -> Result<T, E>, ) -> Result<T, ConfigGetError>
Looks up value by name
, converts it by using the given function.
Sourcepub fn get_table(
&self,
name: impl ToConfigNamePath,
) -> Result<ConfigTable, ConfigGetError>
pub fn get_table( &self, name: impl ToConfigNamePath, ) -> Result<ConfigTable, ConfigGetError>
Looks up sub table by name
.
Use table_keys(prefix)
and get([prefix, key])
instead if table
values have to be converted to non-generic value type.
Sourcepub fn table_keys(
&self,
name: impl ToConfigNamePath,
) -> impl Iterator<Item = &str>
pub fn table_keys( &self, name: impl ToConfigNamePath, ) -> impl Iterator<Item = &str>
Returns iterator over sub table keys at name
.
Trait Implementations§
Source§impl Clone for UserSettings
impl Clone for UserSettings
Source§fn clone(&self) -> UserSettings
fn clone(&self) -> UserSettings
Returns a duplicate 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 Freeze for UserSettings
impl RefUnwindSafe for UserSettings
impl Send for UserSettings
impl Sync for UserSettings
impl Unpin for UserSettings
impl UnwindSafe for UserSettings
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<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