pub struct Query { /* private fields */ }Expand description
The nouns of the plugin contract that appear in the engine’s answers, so an interface needs nothing but this crate.
Implementations§
Source§impl Query
impl Query
pub fn builder() -> QueryBuilder
Sourcepub fn check(&self) -> Result<(), QueryError>
pub fn check(&self) -> Result<(), QueryError>
A query has to ask something: one read from JSON may not.
pub fn pattern(pattern: impl Into<String>) -> Query
pub fn of_kind(kind: impl Into<String>) -> Query
pub fn of_symbol(symbol: SymbolKind) -> Query
pub fn named(name: impl Into<String>) -> Query
pub fn with_kind(self, kind: impl Into<String>) -> Query
pub fn with_symbol(self, symbol: SymbolKind) -> Query
pub fn with_name(self, name: impl Into<String>) -> Query
pub fn in_language(self, language: impl Into<LanguageId>) -> Query
pub fn pattern_str(&self) -> Option<&str>
pub fn kind_str(&self) -> Option<&str>
pub fn symbol(&self) -> Option<SymbolKind>
pub fn name(&self) -> Option<&str>
pub fn language(&self) -> Option<&LanguageId>
Sourcepub fn is_structural(&self) -> bool
pub fn is_structural(&self) -> bool
True when the query selects nodes structurally (pattern or kind).
Sourcepub fn is_symbolic(&self) -> bool
pub fn is_symbolic(&self) -> bool
True when the query filters on declarations (symbol or name).
Sourcepub fn literals(&self) -> Vec<&str>
pub fn literals(&self) -> Vec<&str>
Words every match must contain as whole tokens: the identifier- and number-like runs of the pattern that are not meta-variables, and the symbol name. A file whose text lacks any of them cannot match, so a search may skip it without parsing. Empty for a kind-only query.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Query
impl<'de> Deserialize<'de> for Query
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Query, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Query, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Query
Source§impl From<Query> for SearchQuery
impl From<Query> for SearchQuery
Source§impl Serialize for Query
impl Serialize for Query
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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