use ryo_source::pure::PureFile;
use ryo_symbol::SymbolId;
use crate::{Mutation, ValidationResult};
#[derive(Debug, Clone)]
pub struct RenameMutation {
pub symbol_id: SymbolId,
pub to: String,
}
impl RenameMutation {
pub fn new(symbol_id: SymbolId, to: impl Into<String>) -> Self {
Self {
symbol_id,
to: to.into(),
}
}
}
impl Mutation for RenameMutation {
fn validate(&self, _file: &PureFile) -> ValidationResult {
ValidationResult::new()
}
fn describe(&self) -> String {
format!("Rename symbol {:?} to '{}'", self.symbol_id, self.to)
}
fn mutation_type(&self) -> &'static str {
"Rename"
}
fn box_clone(&self) -> Box<dyn Mutation> {
Box::new(self.clone())
}
}