#[non_exhaustive]pub enum Op {
Replace {
find: String,
replace: String,
regex: bool,
case_insensitive: bool,
multiline: bool,
count: ReplaceCount,
},
Delete {
find: String,
regex: bool,
case_insensitive: bool,
multiline: bool,
},
InsertAfter {
find: String,
content: String,
regex: bool,
case_insensitive: bool,
},
InsertBefore {
find: String,
content: String,
regex: bool,
case_insensitive: bool,
},
ReplaceLine {
find: String,
content: String,
regex: bool,
case_insensitive: bool,
},
Transform {
find: String,
mode: TransformMode,
regex: bool,
case_insensitive: bool,
},
Surround {
find: String,
prefix: String,
suffix: String,
regex: bool,
case_insensitive: bool,
},
Indent {
find: String,
amount: usize,
use_tabs: bool,
regex: bool,
case_insensitive: bool,
},
Dedent {
find: String,
amount: usize,
use_tabs: bool,
regex: bool,
case_insensitive: bool,
},
}Expand description
The intermediate representation for all ripsed operations. Both CLI args and JSON requests are normalized into this form.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Replace
Fields
§
multiline: boolMatch against the whole buffer instead of line-by-line, allowing
patterns to span line boundaries (like ripgrep’s -U).
§
count: ReplaceCountHow many occurrences to replace (default: all).
Delete
Fields
InsertAfter
InsertBefore
ReplaceLine
Transform
Surround
Indent
Dedent
Implementations§
Source§impl Op
impl Op
Sourcepub fn find_pattern(&self) -> &str
pub fn find_pattern(&self) -> &str
Extract the find pattern from the operation.
Sourcepub fn is_multiline(&self) -> bool
pub fn is_multiline(&self) -> bool
Whether this operation matches against the whole buffer (allowing patterns to span line boundaries) instead of line-by-line.
Only Replace and Delete support multiline matching; every other
operation is inherently line-scoped and always returns false.
pub fn is_regex(&self) -> bool
pub fn is_case_insensitive(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Op
impl<'de> Deserialize<'de> for Op
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Op
impl StructuralPartialEq for Op
Auto Trait Implementations§
impl Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnsafeUnpin for Op
impl UnwindSafe for Op
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