user-agent-parser 0.3.4

A parser to get the product, OS, device, cpu, and engine information from a user agent, inspired by https://github.com/faisalman/ua-parser-js and https://github.com/ua-parser/uap-core
Documentation
use std::borrow::Cow;

#[derive(Debug, Clone, Default)]
#[allow(clippy::upper_case_acronyms)]
pub struct CPU<'a> {
    pub architecture: Option<Cow<'a, str>>,
}

impl<'a> CPU<'a> {
    /// Extracts the owned data.
    #[inline]
    pub fn into_owned(self) -> CPU<'static> {
        let architecture = self.architecture.map(|c| Cow::from(c.into_owned()));

        CPU {
            architecture,
        }
    }
}