File tree Expand file tree Collapse file tree 6 files changed +24
-1
lines changed Expand file tree Collapse file tree 6 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 1+ #![ allow( missing_docs) ]
12use std:: path:: { Path , PathBuf } ;
23
34use bstr:: { BStr , ByteSlice } ;
Original file line number Diff line number Diff line change @@ -186,6 +186,9 @@ impl Ignore {
186186}
187187
188188impl 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.
189192 pub fn new ( globals : AttributeMatchGroup ) -> Self {
190193 Attributes {
191194 globals,
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ pub struct Capabilities {
2323 pub symlink : bool ,
2424}
2525
26+ /// A stack of path components with the delegation of side-effects as the currently set path changes, component by component.
2627#[ derive( Clone ) ]
2728pub struct Stack {
2829 /// 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};
33use crate :: fs:: Stack ;
44
55impl Stack {
6+ /// Returns the top-level path of the stack.
67 pub fn root ( & self ) -> & Path {
78 & self . root
89 }
910
11+ /// Returns the absolute path the currently set path.
1012 pub fn current ( & self ) -> & Path {
1113 & self . current
1214 }
1315
16+ /// Returns the currently set path relative to the [`root()`][Stack::root()].
1417 pub fn current_relative ( & self ) -> & Path {
1518 & self . current_relative
1619 }
1720}
1821
22+ /// A delegate for use in a [`Stack`].
1923pub 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.
2028 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.
2133 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.
2238 fn pop_directory ( & mut self ) ;
2339}
2440
Original file line number Diff line number Diff line change 1+ #![ allow( missing_docs) ]
12use bstr:: BString ;
23use git_attributes:: Attributes ;
34
Original file line number Diff line number Diff line change 44 cfg_attr( doc, doc = :: document_features:: document_features!( ) )
55) ]
66#![ deny( unsafe_code) ]
7- #![ deny( rust_2018_idioms) ]
7+ #![ deny( rust_2018_idioms, missing_docs ) ]
88
99/// file system related utilities
1010pub mod fs;
1111
12+ ///
1213pub mod index;
1314
1415pub ( crate ) mod os;
You can’t perform that action at this time.
0 commit comments