pub struct Parser<'a> {
pub regex: Cow<'a, str>,
pub family_replacement: Option<Cow<'a, str>>,
pub v1_replacement: Option<Cow<'a, str>>,
pub v2_replacement: Option<Cow<'a, str>>,
pub v3_replacement: Option<Cow<'a, str>>,
pub v4_replacement: Option<Cow<'a, str>>,
}
Expand description
Individual user agent parser description. Plain data which can be deserialized from serde-compatible storage, or created literally (e.g. using a conversion or build script).
Fields§
§regex: Cow<'a, str>
Regex to check the UA against, if the regex matches the parser applies.
family_replacement: Option<Cow<'a, str>>
If set, used for the ValueRef::family
field. If it
contains a $1
placeholder, that is replaced by the value
of the first match group.
If unset, the first match group is used directly.
v1_replacement: Option<Cow<'a, str>>
If set, provides the value of the major version number, otherwise the second match group is used.
v2_replacement: Option<Cow<'a, str>>
If set, provides the value of the minor version number, otherwise the third match group is used.
v3_replacement: Option<Cow<'a, str>>
If set, provides the value of the patch version number, otherwise the fourth match group is used.
v4_replacement: Option<Cow<'a, str>>
If set, provides the value of the minor patch version number, otherwise the fifth match group is used.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Parser<'a>
impl<'de, 'a> Deserialize<'de> for Parser<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
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
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>
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>
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