user_agent_parser/models/
device.rs1use std::borrow::Cow;
2
3#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
5pub struct Device<'a> {
6 pub name: Option<Cow<'a, str>>,
8 pub brand: Option<Cow<'a, str>>,
10 pub model: Option<Cow<'a, str>>,
12}
13
14impl<'a> Device<'a> {
15 #[inline]
17 pub fn into_owned(self) -> Device<'static> {
18 let name = self.name.map(|c| Cow::from(c.into_owned()));
19 let brand = self.brand.map(|c| Cow::from(c.into_owned()));
20 let model = self.model.map(|c| Cow::from(c.into_owned()));
21
22 Device {
23 name,
24 brand,
25 model,
26 }
27 }
28}