ryo_mutations/basic/
use_stmt.rs1use crate::Mutation;
4
5#[derive(Debug, Clone)]
7pub struct AddUseMutation {
8 pub path: String, }
10
11impl AddUseMutation {
12 pub fn new(path: impl Into<String>) -> Self {
13 Self { path: path.into() }
14 }
15}
16
17impl Mutation for AddUseMutation {
18 fn describe(&self) -> String {
19 format!("Add use {}", self.path)
20 }
21
22 fn mutation_type(&self) -> &'static str {
23 "AddUse"
24 }
25
26 fn box_clone(&self) -> Box<dyn Mutation> {
27 Box::new(self.clone())
28 }
29}
30
31#[derive(Debug, Clone)]
33pub struct RemoveUseMutation {
34 pub path: String,
35}
36
37impl RemoveUseMutation {
38 pub fn new(path: impl Into<String>) -> Self {
39 Self { path: path.into() }
40 }
41}
42
43impl Mutation for RemoveUseMutation {
44 fn describe(&self) -> String {
45 format!("Remove use '{}'", self.path)
46 }
47
48 fn mutation_type(&self) -> &'static str {
49 "RemoveUse"
50 }
51
52 fn box_clone(&self) -> Box<dyn Mutation> {
53 Box::new(self.clone())
54 }
55}