Skip to main content

Detox

Struct Detox 

Source
#[non_exhaustive]
pub struct Detox { pub verbose: bool, pub dry_run: bool, pub recursive: bool, pub collision_cap: u32, /* private fields */ }
Expand description

Configured detox pipeline runner. Construct via DetoxBuilder.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§verbose: bool

Verbose: emit one rename line per change to stdout.

§dry_run: bool

Dry-run: plan and report renames without issuing any rename syscalls.

§recursive: bool

Recursive: descend into directories depth-first leaves-up.

§collision_cap: u32

Maximum collision-resolution suffix attempts before giving up.

Implementations§

Source§

impl Detox

Source

pub fn sanitize(&self, input: &str) -> String

Sanitize one UTF-8 input string, returning UTF-8 output (FR-040).

Lossy reconstruction via String::from_utf8_lossy handles the rare case where the active sequence includes Filter::Uncgi and the input contains percent-escapes that decode to invalid UTF-8 fragments (e.g., a lone %C3). In that case the invalid byte is replaced with U+FFFD in the &str path. Callers needing byte-exact round-tripping for arbitrary inputs MUST use Detox::sanitize_bytes.

Source

pub fn sanitize_bytes(&self, input: &[u8]) -> Vec<u8>

Canonical byte-oriented sanitization entry point (FR-040).

Applies the configured Sequence to input and returns the transformed bytes. No filesystem I/O.

Source

pub fn plan(&self, path: &Path) -> Vec<RenamePlanEntry>

Planned rename(s) for path without executing them (FR-041).

Performs filesystem READS (readdir, stat) as required to enumerate directory contents and check for pre-existing collision targets, but no filesystem MUTATION. Side-effect-free with respect to writes/logs.

Source

pub fn execute(&self, path: &Path) -> Result<DetoxReport, DetoxError>

Execute the rename(s) for path (FR-042).

Produces the same plan as Detox::plan and iterates it issuing rename syscalls (with EXDEV fallback per FR-025). Returns a DetoxReport on success or a DetoxError on the first unrecoverable failure.

Trait Implementations§

Source§

impl Clone for Detox

Source§

fn clone(&self) -> Detox

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Detox

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Detox

§

impl RefUnwindSafe for Detox

§

impl Send for Detox

§

impl Sync for Detox

§

impl Unpin for Detox

§

impl UnsafeUnpin for Detox

§

impl UnwindSafe for Detox

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.