ryo_mutations/basic/
rename.rs1use ryo_source::pure::PureFile;
4use ryo_symbol::SymbolId;
5
6use crate::{Mutation, ValidationResult};
7
8#[derive(Debug, Clone)]
12pub struct RenameMutation {
13 pub symbol_id: SymbolId,
15 pub to: String,
17}
18
19impl RenameMutation {
20 pub fn new(symbol_id: SymbolId, to: impl Into<String>) -> Self {
22 Self {
23 symbol_id,
24 to: to.into(),
25 }
26 }
27}
28
29impl Mutation for RenameMutation {
30 fn validate(&self, _file: &PureFile) -> ValidationResult {
31 ValidationResult::new()
34 }
35
36 fn describe(&self) -> String {
37 format!("Rename symbol {:?} to '{}'", self.symbol_id, self.to)
38 }
39
40 fn mutation_type(&self) -> &'static str {
41 "Rename"
42 }
43
44 fn box_clone(&self) -> Box<dyn Mutation> {
45 Box::new(self.clone())
46 }
47}