[−][src]Struct automaat_processor_string_regex::StringRegex
The processor configuration.
Fields
input: String
The string that will be matched against the provided regex
, and
optionally replaced by the replace
pattern.
regex: String
The regular expression used to match the input
. See the regex crate
syntax documentation for more details.
mismatch_error: Option<String>
If the regex
pattern does not match the input
value, an error is
returned. By default, a generic mismatch error is returned.
You can set this value to have it be returned as the error instead.
replace: Option<String>
Optionally use the regex
pattern and the input
to construct a
replacement string to return as this processors output.
You can use variables such as $1
and $2
to match against the
patterns in the regex.
Trait Implementations
impl Eq for StringRegex
[src]
impl PartialEq<StringRegex> for StringRegex
[src]
fn eq(&self, other: &StringRegex) -> bool
[src]
fn ne(&self, other: &StringRegex) -> bool
[src]
impl Clone for StringRegex
[src]
fn clone(&self) -> StringRegex
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for StringRegex
[src]
impl<'a> Processor<'a> for StringRegex
[src]
const NAME: &'static str
[src]
type Error = Error
If a processor fails its intended purpose, the returned error is turned into a string, and shown in the automaat-web-client
application. Read more
type Output = String
The processor can return any (successful) output it wants, as long as that type implements the [std::fmt::Display
] trait. Read more
fn validate(&self) -> Result<(), Self::Error>
[src]
Validate that the provided regex
pattern is valid.
Errors
If the regex syntax is invalid, the Error::Syntax
error variant is
returned.
If the regex pattern is too big (highly unlikely), the
Error::CompiledTooBig
error variant is returned.
Both variants wrap the original Regex crate errors.
fn run(&self, _context: &Context) -> Result<Option<Self::Output>, Self::Error>
[src]
Do a regex match (and replace), based on the processor configuration.
Output
If replace
is set to None
, the output of the processor will be
Ok(None)
if no error occurred.
If replace
is set to Some
, then Some
is returned, matching the
final replaced output value in Processor::Output
.
Errors
If the regex
pattern does not match the input
input, the
Error::Match
error variant is returned. If mismatch_error
is
set, the error will contain the provided message. If not, a default
message is provided.
If the regex pattern is invalid, the same errors are returned as
validate
.
impl<'de> Deserialize<'de> for StringRegex
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for StringRegex
[src]
Auto Trait Implementations
impl Send for StringRegex
impl Sync for StringRegex
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,