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

Make open/create/builder accept &PathBuf and others #49

Merged
merged 1 commit into from
Jan 9, 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
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ impl RandomAccessDisk {
/// Create a new (auto-sync) instance to storage at `filename`.
#[allow(clippy::new_ret_no_self)]
pub async fn open(
filename: path::PathBuf,
filename: impl AsRef<path::Path>,
) -> Result<RandomAccessDisk, RandomAccessError> {
Self::builder(filename).build().await
}

/// Initialize a builder with storage at `filename`.
pub fn builder(filename: path::PathBuf) -> Builder {
pub fn builder(filename: impl AsRef<path::Path>) -> Builder {
Builder::new(filename)
}
}
Expand Down Expand Up @@ -345,9 +345,9 @@ pub struct Builder {

impl Builder {
/// Create new builder at `path` (with auto-sync true by default).
pub fn new(filename: path::PathBuf) -> Self {
pub fn new(filename: impl AsRef<path::Path>) -> Self {
Self {
filename,
filename: filename.as_ref().into(),
auto_sync: true,
}
}
Expand Down
Loading