pub struct LinkRule { /* private fields */ }Expand description
Composable rule over links.
Implementations§
Source§impl LinkRule
impl LinkRule
Sourcepub const fn query(query: LinkQuery) -> Self
pub const fn query(query: LinkQuery) -> Self
Wraps an existing structural query as a composable rule.
Sourcepub fn typed_metavariable(
name: impl Into<String>,
kind: impl Into<String>,
) -> Self
pub fn typed_metavariable( name: impl Into<String>, kind: impl Into<String>, ) -> Self
Captures links whose kind matches kind.
Sourcepub fn inside(rule: Self, ancestor: Self) -> Self
pub fn inside(rule: Self, ancestor: Self) -> Self
Matches rule only when selected links are inside ancestor.
Sourcepub fn has(rule: Self, descendant: Self) -> Self
pub fn has(rule: Self, descendant: Self) -> Self
Matches rule only when selected links contain a descendant.
Sourcepub fn precedes(rule: Self, following: Self) -> Self
pub fn precedes(rule: Self, following: Self) -> Self
Matches rule only when selected links precede following.
Sourcepub fn follows(rule: Self, preceding: Self) -> Self
pub fn follows(rule: Self, preceding: Self) -> Self
Matches rule only when selected links follow preceding.
Sourcepub fn named(name: impl Into<String>) -> Self
pub fn named(name: impl Into<String>) -> Self
Refers to a named rule in a LinkRuleRegistry.
Sourcepub fn ellipsis_gap(before: Self, after: Self) -> Self
pub fn ellipsis_gap(before: Self, after: Self) -> Self
Matches a parent whose ordered children contain before ... after.
Sourcepub fn text(pattern: impl Into<String>) -> Result<Self, LinkRuleParseError>
pub fn text(pattern: impl Into<String>) -> Result<Self, LinkRuleParseError>
Matches a full document’s plain source text with {{capture}} holes.
Sourcepub fn from_sexpression(source: &str) -> Result<Self, LinkRuleParseError>
pub fn from_sexpression(source: &str) -> Result<Self, LinkRuleParseError>
Parses the documented rule-algebra S-expression surface.
Sourcepub fn matches(
&self,
network: &LinkNetwork,
registry: &LinkRuleRegistry,
) -> Vec<LinkRuleMatch>
pub fn matches( &self, network: &LinkNetwork, registry: &LinkRuleRegistry, ) -> Vec<LinkRuleMatch>
Returns matches for this rule using registry for named sub-rules.
Trait Implementations§
impl Eq for LinkRule
impl StructuralPartialEq for LinkRule
Auto Trait Implementations§
impl Freeze for LinkRule
impl RefUnwindSafe for LinkRule
impl Send for LinkRule
impl Sync for LinkRule
impl Unpin for LinkRule
impl UnsafeUnpin for LinkRule
impl UnwindSafe for LinkRule
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.