1
use crate::commands::Commands;
2
use uniplate::Uniplate;
3

            
4
/// Represents the effects of a successful rule application.
5
///
6
/// Contains the new subtree and any side-effects. This type is not intended to be constructed
7
/// directly, but rather created by the engine to pass to the user-defined selector functions.
8
pub struct Update<T, M>
9
where
10
    T: Uniplate,
11
{
12
    pub(crate) new_subtree: T,
13
    pub(crate) commands: Commands<T, M>,
14
}
15

            
16
impl<T: Uniplate, M> Update<T, M> {
17
    /// The new subtree to be inserted as a result of applying this [`Update`]
18
    pub fn new_subtree(&self) -> &T {
19
        &self.new_subtree
20
    }
21
}