Skip to main content

CascadeSpec

Enum CascadeSpec 

Source
pub enum CascadeSpec {
    AddDerive {
        symbol_id: SymbolId,
        derives: Vec<String>,
    },
    GenerateImpl {
        target: SymbolPath,
        trait_name: String,
        call_new: bool,
    },
    ChangeVisibility {
        symbol_id: SymbolId,
        visibility: Visibility,
    },
    AddUse {
        target_module: SymbolPath,
        path: String,
    },
    AddMatchArm {
        target: SymbolPath,
        function_name: String,
        enum_name: String,
        pattern: String,
        body: String,
    },
    RemoveMatchArm {
        target: SymbolPath,
        function_name: String,
        enum_name: String,
        pattern: String,
    },
}
Expand description

Cascade分析結果として生成される変更仕様

MutationSpecへの変換はryo-executorのFrom<CascadeSpec>で実装される。

Variants§

§

AddDerive

derive macroを追加

例: #[derive(Default)] を追加し、フィールド型にも伝播

Note: symbol_id is required. request_* fields are for diagnostics only.

Fields

§symbol_id: SymbolId

SymbolId - required for O(1) lookup

§derives: Vec<String>

追加するderive macro名

§

GenerateImpl

manual impl blockを生成

derive不可能な場合(フィールド型がderive未対応)に使用

Fields

§target: SymbolPath

対象の型へのパス

§trait_name: String

実装するtrait名

§call_new: bool

new()を自動生成呼び出しするか

§

ChangeVisibility

visibilityを変更

cross-module accessエラーの修正に使用

Fields

§symbol_id: SymbolId

SymbolId - required for O(1) lookup

§visibility: Visibility

新しいvisibility

§

AddUse

use文を追加

型参照の解決に使用

Fields

§target_module: SymbolPath

use文を追加するモジュール

§path: String

追加するパス

§

AddMatchArm

match式に新しいarmを追加

enum variantを追加した際の網羅性エラー修正に使用

Fields

§target: SymbolPath

対象モジュールへのSymbolPath

§function_name: String

match式を含む関数名

§enum_name: String

対象のenum型名

§pattern: String

追加するパターン (e.g., “Status::Cancelled”)

§body: String

armのbody (e.g., “todo!()”)

§

RemoveMatchArm

match式からarmを削除

enum variantを削除した際の不要arm除去に使用

Fields

§target: SymbolPath

対象モジュールへのSymbolPath

§function_name: String

match式を含む関数名

§enum_name: String

対象のenum型名

§pattern: String

削除するパターン (e.g., “Status::Cancelled”)

Implementations§

Source§

impl CascadeSpec

Source

pub fn add_derive(symbol_id: SymbolId, derives: Vec<String>) -> Self

AddDeriveを作成

Source

pub fn generate_impl( target: SymbolPath, trait_name: impl Into<String>, call_new: bool, ) -> Self

GenerateImplを作成

Source

pub fn change_visibility(symbol_id: SymbolId, visibility: Visibility) -> Self

ChangeVisibilityを作成

Source

pub fn add_use(target_module: SymbolPath, path: impl Into<String>) -> Self

AddUseを作成

Source

pub fn add_match_arm( target: SymbolPath, function_name: impl Into<String>, enum_name: impl Into<String>, pattern: impl Into<String>, body: impl Into<String>, ) -> Self

AddMatchArmを作成

Source

pub fn remove_match_arm( target: SymbolPath, function_name: impl Into<String>, enum_name: impl Into<String>, pattern: impl Into<String>, ) -> Self

RemoveMatchArmを作成

Trait Implementations§

Source§

impl Clone for CascadeSpec

Source§

fn clone(&self) -> CascadeSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CascadeSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CascadeSpec

Source§

fn eq(&self, other: &CascadeSpec) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for CascadeSpec

Source§

impl StructuralPartialEq for CascadeSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.