pub struct AddMethodMutation {
pub type_id: SymbolId,
pub name: String,
pub params: Vec<(String, String)>,
pub return_type: Option<String>,
pub body: String,
pub is_pub: bool,
pub takes_self: Option<(bool, bool)>,
}Expand description
Add a method to a struct or enum
New design: Methods are registered directly on the type (e.g., Struct::method).
Impl blocks are file-level constructs, not internal entities.
Fields§
§type_id: SymbolIdSymbolId for the type (Struct or Enum)
name: String§params: Vec<(String, String)>§return_type: Option<String>§body: String§is_pub: bool§takes_self: Option<(bool, bool)>Implementations§
Source§impl AddMethodMutation
impl AddMethodMutation
pub fn new(type_id: SymbolId, name: impl Into<String>) -> Self
pub fn with_self(self) -> Self
pub fn with_mut_self(self) -> Self
pub fn with_owned_self(self) -> Self
pub fn with_params(self, params: Vec<(String, String)>) -> Self
pub fn with_return_type(self, ty: impl Into<String>) -> Self
pub fn with_body(self, body: impl Into<String>) -> Self
pub fn public(self) -> Self
Trait Implementations§
Source§impl Clone for AddMethodMutation
impl Clone for AddMethodMutation
Source§fn clone(&self) -> AddMethodMutation
fn clone(&self) -> AddMethodMutation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AddMethodMutation
impl Debug for AddMethodMutation
Source§impl Mutation for AddMethodMutation
impl Mutation for AddMethodMutation
Source§fn mutation_type(&self) -> &'static str
fn mutation_type(&self) -> &'static str
Get the mutation type name
Source§fn validate(&self, _file: &PureFile) -> ValidationResult
fn validate(&self, _file: &PureFile) -> ValidationResult
Validate the mutation before applying Read more
Source§fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
fn can_proceed(&self, file: &PureFile, strategy: ValidationStrategy) -> bool
Check if this mutation can proceed with the given strategy
Auto Trait Implementations§
impl Freeze for AddMethodMutation
impl RefUnwindSafe for AddMethodMutation
impl Send for AddMethodMutation
impl Sync for AddMethodMutation
impl Unpin for AddMethodMutation
impl UnsafeUnpin for AddMethodMutation
impl UnwindSafe for AddMethodMutation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more