Skip to content

Commit

Permalink
feat: add FromStr impl for Pattern
Browse files Browse the repository at this point in the history
Signed-off-by: Eliza Weisman <[email protected]>
  • Loading branch information
hawkw committed Jul 15, 2019
1 parent 9092305 commit 86a3346
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Regex matchers on character and byte streams.
use regex_automata::{DenseDFA, SparseDFA, StateID, DFA};
use std::{fmt, io, marker::PhantomData};
use std::{fmt, io, marker::PhantomData, str::FromStr};

pub use regex_automata::Error;

Expand Down Expand Up @@ -34,6 +34,13 @@ impl Pattern {
}
}

impl FromStr for Pattern {
type Err = Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Self::new(s)
}
}

impl<S, A> Pattern<S, A>
where
S: StateID,
Expand Down

0 comments on commit 86a3346

Please sign in to comment.