File tree 6 files changed +24
-1
lines changed 6 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ #![ allow( missing_docs) ]
1
2
use std:: path:: { Path , PathBuf } ;
2
3
3
4
use bstr:: { BStr , ByteSlice } ;
Original file line number Diff line number Diff line change @@ -186,6 +186,9 @@ impl Ignore {
186
186
}
187
187
188
188
impl Attributes {
189
+ /// Create a new instance from an attribute match group that represents `globals`.
190
+ ///
191
+ /// A stack of attributes will be applied on top of it later.
189
192
pub fn new ( globals : AttributeMatchGroup ) -> Self {
190
193
Attributes {
191
194
globals,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ pub struct Capabilities {
23
23
pub symlink : bool ,
24
24
}
25
25
26
+ /// A stack of path components with the delegation of side-effects as the currently set path changes, component by component.
26
27
#[ derive( Clone ) ]
27
28
pub struct Stack {
28
29
/// The prefix/root for all paths we handle.
Original file line number Diff line number Diff line change @@ -3,22 +3,38 @@ use std::path::{Path, PathBuf};
3
3
use crate :: fs:: Stack ;
4
4
5
5
impl Stack {
6
+ /// Returns the top-level path of the stack.
6
7
pub fn root ( & self ) -> & Path {
7
8
& self . root
8
9
}
9
10
11
+ /// Returns the absolute path the currently set path.
10
12
pub fn current ( & self ) -> & Path {
11
13
& self . current
12
14
}
13
15
16
+ /// Returns the currently set path relative to the [`root()`][Stack::root()].
14
17
pub fn current_relative ( & self ) -> & Path {
15
18
& self . current_relative
16
19
}
17
20
}
18
21
22
+ /// A delegate for use in a [`Stack`].
19
23
pub trait Delegate {
24
+ /// Called whenever we push a directory on top of the stack, after the fact.
25
+ ///
26
+ /// It is also called if the currently acted on path is a directory in itself.
27
+ /// Use `stack.current()` to see the directory.
20
28
fn push_directory ( & mut self , stack : & Stack ) -> std:: io:: Result < ( ) > ;
29
+
30
+ /// Called after any component was pushed, with the path available at `stack.current()`.
31
+ ///
32
+ /// `is_last_component` is true if the path is completely built.
21
33
fn push ( & mut self , is_last_component : bool , stack : & Stack ) -> std:: io:: Result < ( ) > ;
34
+
35
+ /// Called right after a directory-component was popped off the stack.
36
+ ///
37
+ /// Use it to pop information off internal data structures.
22
38
fn pop_directory ( & mut self ) ;
23
39
}
24
40
Original file line number Diff line number Diff line change
1
+ #![ allow( missing_docs) ]
1
2
use bstr:: BString ;
2
3
use git_attributes:: Attributes ;
3
4
Original file line number Diff line number Diff line change 4
4
cfg_attr( doc, doc = :: document_features:: document_features!( ) )
5
5
) ]
6
6
#![ deny( unsafe_code) ]
7
- #![ deny( rust_2018_idioms) ]
7
+ #![ deny( rust_2018_idioms, missing_docs ) ]
8
8
9
9
/// file system related utilities
10
10
pub mod fs;
11
11
12
+ ///
12
13
pub mod index;
13
14
14
15
pub ( crate ) mod os;
You can’t perform that action at this time.
0 commit comments