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