user_agent_parser/models/
engine.rs1use std::borrow::Cow;
2
3#[derive(Debug, Clone, Default)]
4pub struct Engine<'a> {
5 pub name: Option<Cow<'a, str>>,
6 pub major: Option<Cow<'a, str>>,
7 pub minor: Option<Cow<'a, str>>,
8 pub patch: Option<Cow<'a, str>>,
9}
10
11impl<'a> Engine<'a> {
12 #[inline]
14 pub fn into_owned(self) -> Engine<'static> {
15 let name = self.name.map(|c| Cow::from(c.into_owned()));
16 let major = self.major.map(|c| Cow::from(c.into_owned()));
17 let minor = self.minor.map(|c| Cow::from(c.into_owned()));
18 let patch = self.patch.map(|c| Cow::from(c.into_owned()));
19
20 Engine {
21 name,
22 major,
23 minor,
24 patch,
25 }
26 }
27}