Skip to content

Commit

Permalink
Use bon instead of typed-builder
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX committed Aug 6, 2024
1 parent 76257c0 commit 9e28a4f
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 34 deletions.
116 changes: 91 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fuc_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ categories = ["filesystem"]
license.workspace = true

[dependencies]
bon = "1.0.6"
crossbeam-channel = "0.5.13"
thiserror = "1.0.63"
tracing = { version = "0.1.40", default-features = false, features = ["attributes"], optional = true }
typed-builder = "0.19.1"

[target.'cfg(target_os = "linux")'.dependencies]
rustix = { version = "0.38.34", features = ["fs", "thread", "linux_latest"] }
Expand Down
8 changes: 4 additions & 4 deletions fuc_engine/api.golden
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ impl<T> tracing::instrument::Instrument for fuc_engine::Error
impl<T> tracing::instrument::WithSubscriber for fuc_engine::Error
pub struct fuc_engine::CopyOp<'a, 'b, I1: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, I2: core::convert::Into<alloc::borrow::Cow<'b, std::path::Path>> + 'b, F: core::iter::traits::collect::IntoIterator<Item = (I1, I2)>>
impl<'a, 'b, I1: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, I2: core::convert::Into<alloc::borrow::Cow<'b, std::path::Path>> + 'b, F: core::iter::traits::collect::IntoIterator<Item = (I1, I2)>> fuc_engine::CopyOp<'a, 'b, I1, I2, F>
pub fn fuc_engine::CopyOp<'a, 'b, I1, I2, F>::run(self) -> core::result::Result<(), fuc_engine::Error>
pub fn fuc_engine::CopyOp<'a, 'b, I1, I2, F>::builder() -> CopyOpBuilder<'a, 'b, I1, I2, F>
impl<'a, 'b, I1: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, I2: core::convert::Into<alloc::borrow::Cow<'b, std::path::Path>> + 'b, F: core::iter::traits::collect::IntoIterator<Item = (I1, I2)>> fuc_engine::CopyOp<'a, 'b, I1, I2, F>
pub fn fuc_engine::CopyOp<'a, 'b, I1, I2, F>::builder() -> CopyOpBuilder<'a, 'b, I1, I2, F, ((), (), (), (), ())>
pub fn fuc_engine::CopyOp<'a, 'b, I1, I2, F>::run(self) -> core::result::Result<(), fuc_engine::Error>
impl<'a, 'b, I1: core::fmt::Debug + core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, I2: core::fmt::Debug + core::convert::Into<alloc::borrow::Cow<'b, std::path::Path>> + 'b, F: core::fmt::Debug + core::iter::traits::collect::IntoIterator<Item = (I1, I2)>> core::fmt::Debug for fuc_engine::CopyOp<'a, 'b, I1, I2, F>
pub fn fuc_engine::CopyOp<'a, 'b, I1, I2, F>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
impl<'a, 'b, I1, I2, F> core::marker::Freeze for fuc_engine::CopyOp<'a, 'b, I1, I2, F> where F: core::marker::Freeze
Expand Down Expand Up @@ -74,10 +74,10 @@ pub fn fuc_engine::CopyOp<'a, 'b, I1, I2, F>::from(t: T) -> T
impl<T> tracing::instrument::Instrument for fuc_engine::CopyOp<'a, 'b, I1, I2, F>
impl<T> tracing::instrument::WithSubscriber for fuc_engine::CopyOp<'a, 'b, I1, I2, F>
pub struct fuc_engine::RemoveOp<'a, I: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, F: core::iter::traits::collect::IntoIterator<Item = I>>
impl<'a, I: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, F: core::iter::traits::collect::IntoIterator<Item = I>> fuc_engine::RemoveOp<'a, I, F>
pub fn fuc_engine::RemoveOp<'a, I, F>::builder() -> RemoveOpBuilder<'a, I, F>
impl<'a, I: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>>, F: core::iter::traits::collect::IntoIterator<Item = I>> fuc_engine::RemoveOp<'a, I, F>
pub fn fuc_engine::RemoveOp<'a, I, F>::run(self) -> core::result::Result<(), fuc_engine::Error>
impl<'a, I: core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, F: core::iter::traits::collect::IntoIterator<Item = I>> fuc_engine::RemoveOp<'a, I, F>
pub fn fuc_engine::RemoveOp<'a, I, F>::builder() -> RemoveOpBuilder<'a, I, F, ((), (), (), ())>
impl<'a, I: core::fmt::Debug + core::convert::Into<alloc::borrow::Cow<'a, std::path::Path>> + 'a, F: core::fmt::Debug + core::iter::traits::collect::IntoIterator<Item = I>> core::fmt::Debug for fuc_engine::RemoveOp<'a, I, F>
pub fn fuc_engine::RemoveOp<'a, I, F>::fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
impl<'a, I, F> core::marker::Freeze for fuc_engine::RemoveOp<'a, I, F> where F: core::marker::Freeze
Expand Down
5 changes: 3 additions & 2 deletions fuc_engine/src/ops/copy.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{borrow::Cow, fmt::Debug, fs, io, marker::PhantomData, path::Path};

use typed_builder::TypedBuilder;
use bon::builder;

use crate::{
ops::{compat::DirectoryOp, IoErr},
Expand All @@ -19,7 +19,8 @@ pub fn copy_file<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<(), E
.run()
}

#[derive(TypedBuilder, Debug)]
#[derive(Debug)]
#[builder]
pub struct CopyOp<
'a,
'b,
Expand Down
5 changes: 3 additions & 2 deletions fuc_engine/src/ops/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
path::{Path, MAIN_SEPARATOR_STR},
};

use typed_builder::TypedBuilder;
use bon::builder;

use crate::{
ops::{compat::DirectoryOp, IoErr},
Expand All @@ -29,7 +29,8 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> Result<(), Error> {
.run()
}

#[derive(TypedBuilder, Debug)]
#[derive(Debug)]
#[builder]
pub struct RemoveOp<'a, I: Into<Cow<'a, Path>> + 'a, F: IntoIterator<Item = I>> {
files: F,
#[builder(default = false)]
Expand Down

0 comments on commit 9e28a4f

Please sign in to comment.