Skip to main content

vvv_engine/protocol/intent/
move_symbol.rs

1use std::path::PathBuf;
2
3use serde::{Deserialize, Serialize};
4
5/// Move one declaration — with what belongs to it in the text, and for Rust
6/// its `impl` blocks — from the file declaring it to another file of the
7/// same language, and make every reference follow.
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9pub struct MoveSymbolIntent {
10    pub name: String,
11    /// The file declaring it.
12    pub from: PathBuf,
13    /// The file to declare it in; it must exist.
14    pub to: PathBuf,
15}
16
17impl MoveSymbolIntent {
18    pub fn new(name: impl Into<String>, from: impl Into<PathBuf>, to: impl Into<PathBuf>) -> Self {
19        Self {
20            name: name.into(),
21            from: from.into(),
22            to: to.into(),
23        }
24    }
25}