pub struct ReplacementRule { /* private fields */ }Expand description
Replacement rule used by the query-and-transform surface.
Implementations§
Source§impl ReplacementRule
impl ReplacementRule
Sourcepub fn captured_text(
capture_name: impl Into<String>,
replacement: impl Into<String>,
) -> Self
pub fn captured_text( capture_name: impl Into<String>, replacement: impl Into<String>, ) -> Self
Replaces the source text covered by links captured under capture_name.
Captured syntax links are rewritten by changing the token links inside the captured range, so all tokens outside the captured links keep their original text and order.
Sourcepub const fn substitution(rule: SubstitutionRule) -> Self
pub const fn substitution(rule: SubstitutionRule) -> Self
Applies an exact-reference substitution via LinkNetwork::apply_substitution.
Sourcepub const fn variable_substitution(rule: VariableSubstitutionRule) -> Self
pub const fn variable_substitution(rule: VariableSubstitutionRule) -> Self
Applies a variable substitution via LinkNetwork::apply_variable_substitution.
Sourcepub fn quasiquote(
capture_name: impl Into<String>,
template: QuasiquoteTemplate,
) -> Self
pub fn quasiquote( capture_name: impl Into<String>, template: QuasiquoteTemplate, ) -> Self
Replaces captured source text with a quasiquote template.
Placeholders use {{capture_name}} and are resolved from the same query
match before each replacement is applied.
Trait Implementations§
Source§impl Clone for ReplacementRule
impl Clone for ReplacementRule
Source§fn clone(&self) -> ReplacementRule
fn clone(&self) -> ReplacementRule
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 ReplacementRule
impl Debug for ReplacementRule
impl Eq for ReplacementRule
Source§impl PartialEq for ReplacementRule
impl PartialEq for ReplacementRule
impl StructuralPartialEq for ReplacementRule
Auto Trait Implementations§
impl Freeze for ReplacementRule
impl RefUnwindSafe for ReplacementRule
impl Send for ReplacementRule
impl Sync for ReplacementRule
impl Unpin for ReplacementRule
impl UnsafeUnpin for ReplacementRule
impl UnwindSafe for ReplacementRule
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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