Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractFilesystem: Add doc comments #40

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/afs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ use std::fs::read_dir;
use std::io;
use std::path::Path;

/// A trait for abstracting over filesystem operations.
///
/// This trait is primarily used for target auto-discovery in the
/// [`complete_from_abstract_filesystem()`](crate::Manifest::complete_from_abstract_filesystem) method.
pub trait AbstractFilesystem {
/// Returns a set of file and folder names in the given directory.
///
/// This method should return a [std::io::ErrorKind::NotFound] error if the
/// directory does not exist.
Comment on lines +13 to +14
Copy link
Collaborator Author

@Turbo87 Turbo87 Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered that the read_dir() call in the Filesystem impl also likes to return std::io::ErrorKind::NotADirectory in some cases. Unfortunately, that variant has been unstable for the past 3ish years so we can't actually produce it ourselves and neither can we match against it... 😩

Related:

fn file_names_in<T: AsRef<Path>>(&self, rel_path: T) -> io::Result<BTreeSet<Box<str>>>;
}

/// A [AbstractFilesystem] implementation that reads from the actual filesystem
/// within the given root path.
pub struct Filesystem<'a> {
path: &'a Path,
}
Expand Down
Loading