user_agent_parser/models/cpu.rs
1use std::borrow::Cow;
2
3/// The CPU architecture a user agent runs on.
4#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
5#[allow(clippy::upper_case_acronyms)]
6pub struct CPU<'a> {
7 /// The architecture, such as `amd64` or `arm64`, or `None` when no pattern matches.
8 pub architecture: Option<Cow<'a, str>>,
9}
10
11impl<'a> CPU<'a> {
12 /// Extracts the owned data.
13 #[inline]
14 pub fn into_owned(self) -> CPU<'static> {
15 let architecture = self.architecture.map(|c| Cow::from(c.into_owned()));
16
17 CPU {
18 architecture,
19 }
20 }
21}