pub struct Any<T: Validate = All> {
pub name: &'static str,
pub section: &'static dyn Section,
pub subsection_requirement: Option<SubSectionRequirement>,
pub link: Option<Link>,
pub note: Option<Note>,
/* private fields */
}Expand description
Implements a value without any constraints, i.e. a any value.
Fields§
§name: &'static strThe key of the value in the git configuration.
section: &'static dyn SectionThe parent section of the key.
subsection_requirement: Option<SubSectionRequirement>The subsection requirement to use.
link: Option<Link>A link to other resources that might be eligible as value.
note: Option<Note>A note about this key.
Implementations§
Source§impl Any<FullNameRef>
impl Any<FullNameRef>
Sourcepub fn try_into_fullrefname(
value: Cow<'_, BStr>,
) -> Result<Cow<'_, FullNameRef>, Error>
pub fn try_into_fullrefname( value: Cow<'_, BStr>, ) -> Result<Cow<'_, FullNameRef>, Error>
Return the validated full ref name from value if it is valid.
Source§impl Any<Workers>
impl Any<Workers>
Sourcepub fn try_from_workers(
&'static self,
value: Result<i64, Error>,
) -> Result<usize, Error>
pub fn try_from_workers( &'static self, value: Result<i64, Error>, ) -> Result<usize, Error>
Return the amount of threads to use for checkout, with 0 meaning all available ones, after decoding our integer value from config,
or None if the value isn’t set which is typically interpreted as “as many threads as available”
Source§impl Any<CheckRoundTripEncoding>
impl Any<CheckRoundTripEncoding>
Sourcepub fn try_into_encodings(
&'static self,
value: Option<Cow<'_, BStr>>,
) -> Result<Vec<&'static Encoding>, Error>
Available on crate feature attributes only.
pub fn try_into_encodings( &'static self, value: Option<Cow<'_, BStr>>, ) -> Result<Vec<&'static Encoding>, Error>
attributes only.Convert value into a list of encodings, which are either space or coma separated. Fail if an encoding is unknown.
If None, the default is returned.
Source§impl Any<Eol>
impl Any<Eol>
Sourcepub fn try_into_eol(
&'static self,
value: Cow<'_, BStr>,
) -> Result<Mode, GenericErrorWithValue>
Available on crate feature attributes only.
pub fn try_into_eol( &'static self, value: Cow<'_, BStr>, ) -> Result<Mode, GenericErrorWithValue>
attributes only.Convert value into the default end-of-line mode.
§Deviation
git will allow any value and silently leaves it unset, we will fail if the value is not known.
Source§impl Any<SafeCrlf>
impl Any<SafeCrlf>
Sourcepub fn try_into_safecrlf(
&'static self,
value: Cow<'_, BStr>,
) -> Result<CrlfRoundTripCheck, GenericErrorWithValue>
Available on crate feature attributes only.
pub fn try_into_safecrlf( &'static self, value: Cow<'_, BStr>, ) -> Result<CrlfRoundTripCheck, GenericErrorWithValue>
attributes only.Convert value into the safe-crlf enumeration, if possible.
Source§impl Any<AutoCrlf>
impl Any<AutoCrlf>
Sourcepub fn try_into_autocrlf(
&'static self,
value: Cow<'_, BStr>,
) -> Result<AutoCrlf, GenericErrorWithValue>
Available on crate feature attributes only.
pub fn try_into_autocrlf( &'static self, value: Cow<'_, BStr>, ) -> Result<AutoCrlf, GenericErrorWithValue>
attributes only.Convert value into the safe-crlf enumeration, if possible.
Source§impl Any<Disambiguate>
impl Any<Disambiguate>
Sourcepub fn try_into_object_kind_hint(
&'static self,
value: Cow<'_, BStr>,
) -> Result<Option<ObjectKindHint>, GenericErrorWithValue>
Available on crate feature revision only.
pub fn try_into_object_kind_hint( &'static self, value: Cow<'_, BStr>, ) -> Result<Option<ObjectKindHint>, GenericErrorWithValue>
revision only.Convert a disambiguation marker into the respective enum.
Source§impl Any<LogAllRefUpdates>
impl Any<LogAllRefUpdates>
Sourcepub fn try_into_ref_updates(
&'static self,
value: Option<Result<bool, Error>>,
) -> Result<Option<WriteReflog>, GenericErrorWithValue>
pub fn try_into_ref_updates( &'static self, value: Option<Result<bool, Error>>, ) -> Result<Option<WriteReflog>, GenericErrorWithValue>
Returns the mode for ref-updates as parsed from value. If value is not a boolean, we try
to interpret the string value instead. For correctness, this two step process is necessary as
the interpretation of booleans in special in git-config, i.e. we can’t just treat it as string.
Source§impl Any<CheckStat>
impl Any<CheckStat>
Sourcepub fn try_into_checkstat(
&'static self,
value: Cow<'_, BStr>,
) -> Result<bool, GenericErrorWithValue>
pub fn try_into_checkstat( &'static self, value: Cow<'_, BStr>, ) -> Result<bool, GenericErrorWithValue>
Returns true if the full set of stat entries should be checked, and it’s just as lenient as git.
Source§impl Any<Abbrev>
impl Any<Abbrev>
Sourcepub fn try_into_abbreviation(
&'static self,
hex_len_str: Cow<'_, BStr>,
object_hash: Kind,
) -> Result<Option<usize>, Error>
pub fn try_into_abbreviation( &'static self, hex_len_str: Cow<'_, BStr>, object_hash: Kind, ) -> Result<Option<usize>, Error>
Convert the given hex_len_str into the amount of characters that a short hash should have.
If None is returned, the correct value can be determined based on the amount of objects in the repo.
Source§impl Any<Binary>
impl Any<Binary>
Sourcepub fn try_into_binary(
&'static self,
value: Option<Cow<'_, BStr>>,
) -> Result<Option<bool>, GenericErrorWithValue>
Available on crate feature blob-diff only.
pub fn try_into_binary( &'static self, value: Option<Cow<'_, BStr>>, ) -> Result<Option<bool>, GenericErrorWithValue>
blob-diff only.Convert value into a tri-state boolean that can take the special value auto, resulting in None, or is a boolean.
If None is given, it’s treated as implicit boolean true, as this method is made to be used
with gix_config::file::section::Body::value_implicit().
Source§impl Any<Renames>
impl Any<Renames>
Sourcepub const fn new_renames(
name: &'static str,
section: &'static dyn Section,
) -> Self
Available on crate feature blob-diff only.
pub const fn new_renames( name: &'static str, section: &'static dyn Section, ) -> Self
blob-diff only.Create a new instance.
Sourcepub fn try_into_renames(
&'static self,
value: Result<bool, Error>,
) -> Result<Tracking, GenericError>
Available on crate feature blob-diff only.
pub fn try_into_renames( &'static self, value: Result<bool, Error>, ) -> Result<Tracking, GenericError>
blob-diff only.Try to convert the configuration into a valid rename tracking variant. Use value and if it’s an error, interpret
the boolean as string
Source§impl Any<ObjectFormat>
impl Any<ObjectFormat>
pub fn try_into_object_format( &'static self, value: Cow<'_, BStr>, ) -> Result<Kind, GenericErrorWithValue>
Source§impl Any<NegotiationAlgorithm>
impl Any<NegotiationAlgorithm>
Sourcepub fn try_into_negotiation_algorithm(
&'static self,
name: Cow<'_, BStr>,
) -> Result<Algorithm, GenericErrorWithValue>
Available on crate feature credentials only.
pub fn try_into_negotiation_algorithm( &'static self, name: Cow<'_, BStr>, ) -> Result<Algorithm, GenericErrorWithValue>
credentials only.Derive the negotiation algorithm identified by name, case-sensitively.
Source§impl Any<RecurseSubmodules>
impl Any<RecurseSubmodules>
Sourcepub fn try_into_recurse_submodules(
&'static self,
value: Result<bool, Error>,
) -> Result<FetchRecurse, GenericErrorWithValue>
Available on crate feature attributes only.
pub fn try_into_recurse_submodules( &'static self, value: Result<bool, Error>, ) -> Result<FetchRecurse, GenericErrorWithValue>
attributes only.Obtain the way submodules should be updated.
Source§impl Any<RefsNamespace>
impl Any<RefsNamespace>
Source§impl Any<SslVersion>
impl Any<SslVersion>
pub const fn new_ssl_version( name: &'static str, section: &'static dyn Section, ) -> Self
Source§impl Any<ProxyAuthMethod>
impl Any<ProxyAuthMethod>
pub const fn new_proxy_auth_method( name: &'static str, section: &'static dyn Section, ) -> Self
Source§impl Any<FollowRedirects>
impl Any<FollowRedirects>
Sourcepub fn try_into_follow_redirects(
&'static self,
value: Cow<'_, BStr>,
boolean: impl FnOnce() -> Result<Option<bool>, Error>,
) -> Result<FollowRedirects, GenericErrorWithValue>
Available on crate features blocking-http-transport-reqwest or blocking-http-transport-curl only.
pub fn try_into_follow_redirects( &'static self, value: Cow<'_, BStr>, boolean: impl FnOnce() -> Result<Option<bool>, Error>, ) -> Result<FollowRedirects, GenericErrorWithValue>
blocking-http-transport-reqwest or blocking-http-transport-curl only.Convert value into the redirect specification, or query the same value as boolean
for additional possible input values.
Note that boolean only queries the underlying key as boolean, which is a necessity to handle
empty booleans correctly, that is those without a value separator.
Source§impl Any<ExtraHeader>
impl Any<ExtraHeader>
Source§impl Any<Version>
impl Any<Version>
pub fn try_into_http_version( &'static self, value: Cow<'_, BStr>, ) -> Result<HttpVersion, GenericErrorWithValue>
blocking-http-transport-reqwest or blocking-http-transport-curl only.Source§impl Any<ProxyAuthMethod>
impl Any<ProxyAuthMethod>
pub fn try_into_proxy_auth_method( &'static self, value: Cow<'_, BStr>, ) -> Result<ProxyAuthMethod, GenericErrorWithValue>
blocking-http-transport-reqwest or blocking-http-transport-curl only.Source§impl Any<SslVersion>
impl Any<SslVersion>
pub fn try_into_ssl_version( &'static self, value: Cow<'_, BStr>, ) -> Result<SslVersion, Error>
blocking-http-transport-reqwest or blocking-http-transport-curl only.Source§impl Any<IndexThreads>
impl Any<IndexThreads>
Sourcepub fn try_into_index_threads(
&'static self,
value: Cow<'_, BStr>,
) -> Result<usize, GenericErrorWithValue>
pub fn try_into_index_threads( &'static self, value: Cow<'_, BStr>, ) -> Result<usize, GenericErrorWithValue>
Parse value into the amount of threads to use, with 1 being single-threaded, or 0 indicating
to select the amount of threads, with any other number being the specific amount of threads to use.
Source§impl Any<ConflictStyle>
impl Any<ConflictStyle>
Sourcepub fn try_into_conflict_style(
&'static self,
name: Cow<'_, BStr>,
) -> Result<ConflictStyle, GenericErrorWithValue>
Available on crate feature merge only.
pub fn try_into_conflict_style( &'static self, name: Cow<'_, BStr>, ) -> Result<ConflictStyle, GenericErrorWithValue>
merge only.Derive the diff algorithm identified by name, case-insensitively.
Source§impl Any<IndexVersion>
impl Any<IndexVersion>
Sourcepub fn try_into_index_version(
&'static self,
value: Result<i64, Error>,
) -> Result<Version, GenericError>
pub fn try_into_index_version( &'static self, value: Result<i64, Error>, ) -> Result<Version, GenericError>
Try to interpret an integer value as index version.
Source§impl Any<Allow>
impl Any<Allow>
Sourcepub fn try_into_allow(
&'static self,
value: Cow<'_, BStr>,
scheme: Option<&str>,
) -> Result<Allow, Error>
Available on crate features blocking-network-client or async-network-client only.
pub fn try_into_allow( &'static self, value: Cow<'_, BStr>, scheme: Option<&str>, ) -> Result<Allow, Error>
blocking-network-client or async-network-client only.Convert value into its respective Allow variant, possibly informing about the scheme we are looking at in the error.
Source§impl Any<Version>
impl Any<Version>
Sourcepub fn try_into_protocol_version(
&'static self,
value: Option<Result<i64, Error>>,
) -> Result<Protocol, GenericErrorWithValue>
Available on crate features blocking-network-client or async-network-client only.
pub fn try_into_protocol_version( &'static self, value: Option<Result<i64, Error>>, ) -> Result<Protocol, GenericErrorWithValue>
blocking-network-client or async-network-client only.Convert value into the corresponding protocol version, possibly applying the correct default.
Source§impl Any<Default>
impl Any<Default>
Sourcepub fn try_into_default(
&'static self,
value: Cow<'_, BStr>,
) -> Result<Default, GenericErrorWithValue>
pub fn try_into_default( &'static self, value: Cow<'_, BStr>, ) -> Result<Default, GenericErrorWithValue>
Try to interpret value as push.default.
Source§impl Any<TagOpt>
impl Any<TagOpt>
Sourcepub fn try_into_tag_opt(
&'static self,
value: Cow<'_, BStr>,
) -> Result<Tags, GenericErrorWithValue>
pub fn try_into_tag_opt( &'static self, value: Cow<'_, BStr>, ) -> Result<Tags, GenericErrorWithValue>
Try to interpret value as tag option.
§Note
It’s heavily biased towards the git command-line unfortunately, and the only value of its kind. Maybe in future more values will be supported which are less about passing them to a sub-process.
Source§impl Any<Variant>
impl Any<Variant>
pub fn try_into_variant( &'static self, value: Cow<'_, BStr>, ) -> Result<Option<ProgramKind>, GenericErrorWithValue>
blocking-network-client only.Source§impl Any<ShowUntrackedFiles>
impl Any<ShowUntrackedFiles>
pub fn try_into_show_untracked_files( &'static self, value: Cow<'_, BStr>, ) -> Result<UntrackedFiles, GenericErrorWithValue>
status only.Source§impl Any<DurationInMilliseconds>
impl Any<DurationInMilliseconds>
Sourcepub const fn new_duration(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_duration( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Source§impl Any<LockTimeout>
impl Any<LockTimeout>
Source§impl Any<PushRefSpec>
impl Any<PushRefSpec>
Sourcepub const fn new_push_refspec(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_push_refspec( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Source§impl Any<FetchRefSpec>
impl Any<FetchRefSpec>
Sourcepub const fn new_fetch_refspec(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_fetch_refspec( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Source§impl Any<UnsignedInteger>
impl Any<UnsignedInteger>
Sourcepub const fn new_unsigned_integer(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_unsigned_integer( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Sourcepub fn try_into_usize(
&'static self,
value: Result<i64, Error>,
) -> Result<usize, Error>
pub fn try_into_usize( &'static self, value: Result<i64, Error>, ) -> Result<usize, Error>
Convert value into a usize or wrap it into a specialized error.
Source§impl Any<Time>
impl Any<Time>
Sourcepub const fn new_time(name: &'static str, section: &'static dyn Section) -> Self
pub const fn new_time(name: &'static str, section: &'static dyn Section) -> Self
Create a new instance.
Sourcepub fn try_into_time(
&self,
value: Cow<'_, BStr>,
now: Option<SystemTime>,
) -> Result<Time, Error>
pub fn try_into_time( &self, value: Cow<'_, BStr>, now: Option<SystemTime>, ) -> Result<Time, Error>
Convert the value into a date if possible, with now as reference time for relative dates.
Source§impl Any<Boolean>
impl Any<Boolean>
Sourcepub const fn new_boolean(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_boolean( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Sourcepub fn enrich_error(
&'static self,
value: Result<bool, Error>,
) -> Result<bool, Error>
pub fn enrich_error( &'static self, value: Result<bool, Error>, ) -> Result<bool, Error>
Process the value into a result with an improved error message.
value is expected to be provided by gix_config::File::boolean().
Source§impl Any<RemoteName>
impl Any<RemoteName>
Source§impl<T: Validate> Any<T>
Init other validate implementations
impl<T: Validate> Any<T>
Init other validate implementations
Sourcepub const fn new_with_validate(
name: &'static str,
section: &'static dyn Section,
validate: T,
) -> Self
pub const fn new_with_validate( name: &'static str, section: &'static dyn Section, validate: T, ) -> Self
Create a new instance from name and section
Source§impl<T: Validate> Any<T>
Builder
impl<T: Validate> Any<T>
Builder
Sourcepub const fn with_subsection_requirement(
self,
requirement: Option<SubSectionRequirement>,
) -> Self
pub const fn with_subsection_requirement( self, requirement: Option<SubSectionRequirement>, ) -> Self
Set the subsection requirement to non-default values.
Sourcepub const fn with_environment_override(self, var: &'static str) -> Self
pub const fn with_environment_override(self, var: &'static str) -> Self
Associate an environment variable with this key.
This is mainly useful for enriching error messages.
Sourcepub const fn with_fallback(self, key: &'static dyn Key) -> Self
pub const fn with_fallback(self, key: &'static dyn Key) -> Self
Set a link to another key which serves as fallback to provide a value if this key is not set.
Sourcepub const fn with_note(self, message: &'static str) -> Self
pub const fn with_note(self, message: &'static str) -> Self
Attach an informative message to this key.
Sourcepub const fn with_deviation(self, message: &'static str) -> Self
pub const fn with_deviation(self, message: &'static str) -> Self
Inform about a deviation in how this key is interpreted.
Source§impl<T: Validate> Any<T>
Conversion
impl<T: Validate> Any<T>
Conversion
Source§impl Any<String>
impl Any<String>
Sourcepub const fn new_string(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_string( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Source§impl Any<Program>
impl Any<Program>
Sourcepub const fn new_program(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_program( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Source§impl Any<Executable>
impl Any<Executable>
Sourcepub const fn new_executable(
name: &'static str,
section: &'static dyn Section,
) -> Self
pub const fn new_executable( name: &'static str, section: &'static dyn Section, ) -> Self
Create a new instance.
Trait Implementations§
Source§impl<T: Validate> AsKey for Any<T>
impl<T: Validate> AsKey for Any<T>
Source§fn as_key(&self) -> KeyRef<'_>
fn as_key(&self) -> KeyRef<'_>
remote.origin.url such key would yield access to ("remote", Some("origin"), "url")
while user.name would yield ("user", None, "name"). Read moreSource§fn try_as_key(&self) -> Option<KeyRef<'_>>
fn try_as_key(&self) -> Option<KeyRef<'_>>
remote.origin.url such key would yield access to ("remote", Some("origin"), "url")
while user.name would yield ("user", None, "name").Source§impl<T: Validate> Key for Any<T>
impl<T: Validate> Key for Any<T>
Source§fn validate(&self, value: &BStr) -> Result<(), Error>
fn validate(&self, value: &BStr) -> Result<(), Error>
value is allowed as value of this key, or return a descriptive error if it is not.Source§fn section(&self) -> &dyn Section
fn section(&self) -> &dyn Section
Source§fn subsection_requirement(&self) -> Option<&SubSectionRequirement>
fn subsection_requirement(&self) -> Option<&SubSectionRequirement>
Source§fn environment_override(&self) -> Option<&str>
fn environment_override(&self) -> Option<&str>
Source§fn the_environment_override(&self) -> &str
fn the_environment_override(&self) -> &str
Source§fn logical_name(&self) -> String
fn logical_name(&self) -> String
core.bare for statically known keys, or branch.<name>.key
for complex ones.Source§fn full_name(&self, subsection: Option<&BStr>) -> Result<BString, String>
fn full_name(&self, subsection: Option<&BStr>) -> Result<BString, String>
core.bare, or remote.<subsection>.url if subsection is
not None.
May fail if this key needs a subsection, or may not have a subsection.Source§fn validated_assignment(&self, value: &BStr) -> Result<BString, Error>
fn validated_assignment(&self, value: &BStr) -> Result<BString, Error>
value, suitable for configuration overrides.
Note that this will fail if the key requires a subsection name.Source§fn validated_assignment_fmt(
&self,
value: &dyn Display,
) -> Result<BString, Error>
fn validated_assignment_fmt( &self, value: &dyn Display, ) -> Result<BString, Error>
value, suitable for configuration overrides.
Note that this will fail if the key requires a subsection name.Source§fn validated_assignment_with_subsection(
&self,
value: &BStr,
subsection: &BStr,
) -> Result<BString, Error>
fn validated_assignment_with_subsection( &self, value: &BStr, subsection: &BStr, ) -> Result<BString, Error>
value with the keys full name within subsection, suitable for configuration overrides.
Note that this is only valid if this key supports parameterized sub-sections, or else an error is returned.