pub struct Defaults {
pub signature: MagicSignature,
pub search_mode: SearchMode,
pub literal: bool,
}
Expand description
Default settings for some fields of a Pattern
.
These can be used to represent GIT_*_PATHSPECS
environment variables, for example.
Fields§
§signature: MagicSignature
The default signature.
search_mode: SearchMode
The default search-mode.
Note that even if it’s SearchMode::Literal
, the pathspecs will be parsed as usual, but matched verbatim afterwards.
Note that pathspecs can override this the SearchMode::Literal
variant with an explicit :(glob)
prefix.
literal: bool
If set, the pathspec will not be parsed but used verbatim. Implies SearchMode::Literal
for search_mode
.
Implementations§
source§impl Defaults
impl Defaults
sourcepub fn from_environment(
var: &mut dyn FnMut(&str) -> Option<OsString>,
) -> Result<Self, Error>
pub fn from_environment( var: &mut dyn FnMut(&str) -> Option<OsString>, ) -> Result<Self, Error>
Initialize this instance using information from the environment as
per the official documentation (look for PATHSPECS
),
calling var(variable_name)
for each variable that should be obtained.
Used environment variables are GIT_GLOB_PATHSPECS
, GIT_NOGLOB_PATHSPECS
, GIT_LITERAL_PATHSPECS
and GIT_ICASE_PATHSPECS
.
Note that there are lot of failure modes, and instead of offering lenient parsing, the caller may ignore errors and
use other defaults instead.
§Deviation
Instead of failing if GIT_LITERAL_PATHSPECS
is used with glob globals, we ignore these. Also our implementation allows global
icase
settings in combination with this setting.
Trait Implementations§
source§impl Ord for Defaults
impl Ord for Defaults
source§impl PartialOrd for Defaults
impl PartialOrd for Defaults
impl Copy for Defaults
impl Eq for Defaults
impl StructuralPartialEq for Defaults
Auto Trait Implementations§
impl Freeze for Defaults
impl RefUnwindSafe for Defaults
impl Send for Defaults
impl Sync for Defaults
impl Unpin for Defaults
impl UnwindSafe for Defaults
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)