Skip to content

Commit 15d87ee

Browse files
committed
make it harder to forget documentation in git-worktree
1 parent 0060ade commit 15d87ee

File tree

6 files changed

+24
-1
lines changed

6 files changed

+24
-1
lines changed

git-worktree/src/fs/cache/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(missing_docs)]
12
use std::path::{Path, PathBuf};
23

34
use bstr::{BStr, ByteSlice};

git-worktree/src/fs/cache/state.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ impl Ignore {
186186
}
187187

188188
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.
189192
pub fn new(globals: AttributeMatchGroup) -> Self {
190193
Attributes {
191194
globals,

git-worktree/src/fs/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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)]
2728
pub struct Stack {
2829
/// The prefix/root for all paths we handle.

git-worktree/src/fs/stack.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,38 @@ use std::path::{Path, PathBuf};
33
use crate::fs::Stack;
44

55
impl 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`].
1923
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.
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

git-worktree/src/index/checkout.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(missing_docs)]
12
use bstr::BString;
23
use git_attributes::Attributes;
34

git-worktree/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
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
1010
pub mod fs;
1111

12+
///
1213
pub mod index;
1314

1415
pub(crate) mod os;

0 commit comments

Comments
 (0)