aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-12-18 17:58:42 +0000
committerJonas Schievink <[email protected]>2020-12-18 17:58:42 +0000
commit08de1b4fa57ca78ad13026950b3eb024b7d2abf3 (patch)
tree99279afbe385ee36fdcd3921a4a89784439705cf /crates/syntax
parent03c177af89efcc238053b59069eda2c1c6772622 (diff)
Implement `RawAttr::filter`
Diffstat (limited to 'crates/syntax')
-rw-r--r--crates/syntax/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/syntax/src/lib.rs b/crates/syntax/src/lib.rs
index e753b11bb..4d272f367 100644
--- a/crates/syntax/src/lib.rs
+++ b/crates/syntax/src/lib.rs
@@ -205,6 +205,13 @@ impl ast::Type {
205 } 205 }
206} 206}
207 207
208impl ast::Attr {
209 /// Returns `text`, parsed as an attribute, but only if it has no errors.
210 pub fn parse(text: &str) -> Result<Self, ()> {
211 parsing::parse_text_fragment(text, parser::FragmentKind::Attr)
212 }
213}
214
208/// Matches a `SyntaxNode` against an `ast` type. 215/// Matches a `SyntaxNode` against an `ast` type.
209/// 216///
210/// # Example: 217/// # Example: