1use crate::{tree::recorder::Location, Rewrites};
23mod change;
4pub use change::{Change, ChangeRef};
56/// The error returned by [`tree_with_rewrites()`](super::tree_with_rewrites()).
7#[derive(Debug, thiserror::Error)]
8#[allow(missing_docs)]
9pub enum Error {
10#[error(transparent)]
11Diff(#[from] crate::tree::Error),
12#[error("The user-provided callback failed")]
13ForEach(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
14#[error("Failure during rename tracking")]
15RenameTracking(#[from] crate::rewrites::tracker::emit::Error),
16}
1718/// Returned by the [`tree_with_rewrites()`](super::tree_with_rewrites()) function to control flow.
19#[derive(Default, Clone, Copy, PartialOrd, PartialEq, Ord, Eq, Hash)]
20pub enum Action {
21/// Continue the traversal of changes.
22#[default]
23Continue,
24/// Stop the traversal of changes and stop calling the function that returned it.
25Cancel,
26}
2728/// Options for use in [`tree_with_rewrites()`](super::tree_with_rewrites()).
29#[derive(Default, Clone, Debug)]
30pub struct Options {
31/// Determine how locations of changes, i.e. their repository-relative path, should be tracked.
32 /// If `None`, locations will always be empty.
33pub location: Option<Location>,
34/// If not `None`, rename tracking will be performed accordingly.
35pub rewrites: Option<Rewrites>,
36}
3738pub(super) mod function;