1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! What a directory entry is, read without following a symlink.
//!
//! It is separate from [`FileTree`](super::tree::FileTree) so a reader can match on the four
//! kinds without importing the port, and an implementation of the port has one shared answer type.
//!
//! # Responsibilities
//!
//! - [`EntryKind`] names the four things an entry can be: a regular file, a directory, a symlink,
//! or anything else (a socket, a device, a named pipe).
/// What a directory entry is. A symlink is reported as [`EntryKind::Symlink`], never as what it
/// points at.
///
/// # Examples
///
/// ```
/// use std::path::Path;
///
/// use agentstacks::fs::StdFileTree;
/// use agentstacks::port::{EntryKind, FileTree};
///
/// let pack = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures/packs/valid-hooks");
/// let tree = StdFileTree::new(pack);
/// assert_eq!(tree.kind(Path::new("pack.toml"))?, EntryKind::File);
/// assert_eq!(tree.kind(Path::new("skills"))?, EntryKind::Dir);
/// # Ok::<(), std::io::Error>(())
/// ```