pub struct AddStructMutation {
pub parent: SymbolId,
pub name: String,
pub fields: Vec<StructFieldDef>,
pub is_pub: bool,
pub derives: Vec<String>,
}Expand description
Add a new struct to the file
Fields§
§parent: SymbolIdParent module SymbolId where the struct should be added
name: String§fields: Vec<StructFieldDef>§is_pub: bool§derives: Vec<String>Implementations§
Source§impl AddStructMutation
impl AddStructMutation
pub fn new(parent: SymbolId, name: impl Into<String>) -> Self
pub fn with_field(self, name: impl Into<String>, ty: impl Into<String>) -> Self
Sourcepub fn with_pub_field(
self,
name: impl Into<String>,
ty: impl Into<String>,
) -> Self
pub fn with_pub_field( self, name: impl Into<String>, ty: impl Into<String>, ) -> Self
Add a public field
Sourcepub fn with_fields(self, fields: Vec<(String, String)>) -> Self
pub fn with_fields(self, fields: Vec<(String, String)>) -> Self
Add fields from (name, type) tuples - all private (legacy compatibility)
Sourcepub fn with_fields_vis(self, fields: Vec<(String, String, bool)>) -> Self
pub fn with_fields_vis(self, fields: Vec<(String, String, bool)>) -> Self
Add fields with visibility information
pub fn public(self) -> Self
pub fn with_derives(self, derives: Vec<String>) -> Self
Trait Implementations§
Source§impl Clone for AddStructMutation
impl Clone for AddStructMutation
Source§fn clone(&self) -> AddStructMutation
fn clone(&self) -> AddStructMutation
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 AddStructMutation
impl Debug for AddStructMutation
Source§impl Mutation for AddStructMutation
impl Mutation for AddStructMutation
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
Source§impl ToSerializable for AddStructMutation
impl ToSerializable for AddStructMutation
fn to_serializable(&self) -> SerializableMutation
Auto Trait Implementations§
impl Freeze for AddStructMutation
impl RefUnwindSafe for AddStructMutation
impl Send for AddStructMutation
impl Sync for AddStructMutation
impl Unpin for AddStructMutation
impl UnsafeUnpin for AddStructMutation
impl UnwindSafe for AddStructMutation
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