@@ -68,23 +68,43 @@ impl Options {
6868 self . empty_patterns_match_prefix = toggle;
6969 self
7070 }
71+ /// Like [`empty_patterns_match_prefix()`](Self::empty_patterns_match_prefix), but only requires a mutably borrowed instance.
72+ pub fn set_empty_patterns_match_prefix ( & mut self , toggle : bool ) -> & mut Self {
73+ self . empty_patterns_match_prefix = toggle;
74+ self
75+ }
7176 /// If `toggle` is `true`, we will stop figuring out if any directory that is a candidate for recursion is also a nested repository,
7277 /// which saves time but leads to recurse into it. If `false`, nested repositories will not be traversed.
7378 pub fn recurse_repositories ( mut self , toggle : bool ) -> Self {
7479 self . recurse_repositories = toggle;
7580 self
7681 }
82+ /// Like [`recurse_repositories()`](Self::recurse_repositories), but only requires a mutably borrowed instance.
83+ pub fn set_recurse_repositories ( & mut self , toggle : bool ) -> & mut Self {
84+ self . recurse_repositories = toggle;
85+ self
86+ }
7787 /// If `toggle` is `true`, entries that are pruned and whose [Kind](gix_dir::entry::Kind) is known will be emitted.
7888 pub fn emit_pruned ( mut self , toggle : bool ) -> Self {
7989 self . emit_pruned = toggle;
8090 self
8191 }
92+ /// Like [`emit_pruned()`](Self::emit_pruned), but only requires a mutably borrowed instance.
93+ pub fn set_emit_pruned ( & mut self , toggle : bool ) -> & mut Self {
94+ self . emit_pruned = toggle;
95+ self
96+ }
8297 /// If `value` is `Some(mode)`, entries that are ignored will be emitted according to the given `mode`.
8398 /// If `None`, ignored entries will not be emitted at all.
8499 pub fn emit_ignored ( mut self , value : Option < EmissionMode > ) -> Self {
85100 self . emit_ignored = value;
86101 self
87102 }
103+ /// Like [`emit_ignored()`](Self::emit_ignored), but only requires a mutably borrowed instance.
104+ pub fn set_emit_ignored ( & mut self , value : Option < EmissionMode > ) -> & mut Self {
105+ self . emit_ignored = value;
106+ self
107+ }
88108 /// When the walk is for deletion, `value` must be `Some(_)` to assure we don't collapse directories that have precious files in
89109 /// them, and otherwise assure that no entries are observable that shouldn't be deleted.
90110 /// If `None`, precious files are treated like expendable files, which is usually what you want when displaying them
@@ -93,17 +113,32 @@ impl Options {
93113 self . for_deletion = value;
94114 self
95115 }
116+ /// Like [`for_deletion()`](Self::for_deletion), but only requires a mutably borrowed instance.
117+ pub fn set_for_deletion ( & mut self , value : Option < ForDeletionMode > ) -> & mut Self {
118+ self . for_deletion = value;
119+ self
120+ }
96121 /// If `toggle` is `true`, we will also emit entries for tracked items. Otherwise these will remain 'hidden',
97122 /// even if a pathspec directly refers to it.
98123 pub fn emit_tracked ( mut self , toggle : bool ) -> Self {
99124 self . emit_tracked = toggle;
100125 self
101126 }
127+ /// Like [`emit_tracked()`](Self::emit_tracked), but only requires a mutably borrowed instance.
128+ pub fn set_emit_tracked ( & mut self , toggle : bool ) -> & mut Self {
129+ self . emit_tracked = toggle;
130+ self
131+ }
102132 /// Controls the way untracked files are emitted. By default, this is happening immediately and without any simplification.
103133 pub fn emit_untracked ( mut self , toggle : EmissionMode ) -> Self {
104134 self . emit_untracked = toggle;
105135 self
106136 }
137+ /// Like [`emit_untracked()`](Self::emit_untracked), but only requires a mutably borrowed instance.
138+ pub fn set_emit_untracked ( & mut self , toggle : EmissionMode ) -> & mut Self {
139+ self . emit_untracked = toggle;
140+ self
141+ }
107142 /// If `toggle` is `true`, emit empty directories as well. Note that a directory also counts as empty if it has any
108143 /// amount or depth of nested subdirectories, as long as none of them includes a file.
109144 /// Thus, this makes leaf-level empty directories visible, as those don't have any content.
@@ -112,6 +147,12 @@ impl Options {
112147 self
113148 }
114149
150+ /// Like [`emit_empty_directories()`](Self::emit_empty_directories), but only requires a mutably borrowed instance.
151+ pub fn set_emit_empty_directories ( & mut self , toggle : bool ) -> & mut Self {
152+ self . emit_empty_directories = toggle;
153+ self
154+ }
155+
115156 /// If `toggle` is `true`, we will not only find non-bare repositories in untracked directories, but also bare ones.
116157 ///
117158 /// Note that this is very costly, but without it, bare repositories will appear like untracked directories when collapsed,
@@ -121,10 +162,22 @@ impl Options {
121162 self
122163 }
123164
165+ /// Like [`classify_untracked_bare_repositories()`](Self::classify_untracked_bare_repositories), but only requires a mutably borrowed instance.
166+ pub fn set_classify_untracked_bare_repositories ( & mut self , toggle : bool ) -> & mut Self {
167+ self . classify_untracked_bare_repositories = toggle;
168+ self
169+ }
170+
124171 /// Control whether entries that are in an about-to-be collapsed directory will be emitted. The default is `None`,
125172 /// so entries in a collapsed directory are not observable.
126173 pub fn emit_collapsed ( mut self , value : Option < CollapsedEntriesEmissionMode > ) -> Self {
127174 self . emit_collapsed = value;
128175 self
129176 }
177+
178+ /// Like [`emit_collapsed()`](Self::emit_collapsed), but only requires a mutably borrowed instance.
179+ pub fn set_emit_collapsed ( & mut self , value : Option < CollapsedEntriesEmissionMode > ) -> & mut Self {
180+ self . emit_collapsed = value;
181+ self
182+ }
130183}
0 commit comments