Device

Structin device_detectionfastly 0.13.1View source
pub struct Device { /* private fields */ }

The device data associated with a particular User-Agent string.

Methods

fn brand(&self) -> Option<&str>

The brand of the client device, possibly different from the manufacturer of that device.

Parameters

self: &Self

Returns

Option<&str>

device_name

View source
fn device_name(&self) -> Option<&str>

The name of the client device.

Parameters

self: &Self

Returns

Option<&str>
fn hwtype(&self) -> Option<&str>

A string representation of the primary client platform hardware. The most commonly used device types are also identified via boolean variables. Because a device may have multiple device types and this variable only has the primary type, we recommend using the boolean variables for logic and using this string representation for logging.

Parameters

self: &Self

Returns

Option<&str>
fn is_bot(&self) -> Option<bool>

The client's User-Agent was recognized as belonging to a bot.

Parameters

self: &Self

Returns

Option<bool>

is_desktop

View source
fn is_desktop(&self) -> Option<bool>

The client is a desktop web browser.

Parameters

self: &Self

Returns

Option<bool>

is_downloader

View source
fn is_downloader(&self) -> Option<bool>

The client's User-Agent was recognized as belonging to a downloader.

Parameters

self: &Self

Returns

Option<bool>

is_ereader

View source
fn is_ereader(&self) -> Option<bool>

The client device is a reading device (like a Kindle).

Parameters

self: &Self

Returns

Option<bool>

is_feedreader

View source
fn is_feedreader(&self) -> Option<bool>

The client's User-Agent was recognized as belonging to a feedreader.

Parameters

self: &Self

Returns

Option<bool>

is_gameconsole

View source
fn is_gameconsole(&self) -> Option<bool>

The client device is a video game console (like a PlayStation or Xbox).

Parameters

self: &Self

Returns

Option<bool>

is_identified

View source
fn is_identified(&self) -> Option<bool>

The client's User-Agent was identified.

This returns true when it is possible to populate client device properties based on information supplied in the User-Agent. Which means that in each field of Device we have at least one property that is Some(T).

Parameters

self: &Self

Returns

Option<bool>

is_mediaplayer

View source
fn is_mediaplayer(&self) -> Option<bool>

The client device is a media player (like Blu-ray players, iPod devices, and smart speakers such as Amazon Echo).

Parameters

self: &Self

Returns

Option<bool>

is_mobile

View source
fn is_mobile(&self) -> Option<bool>

The client device is a mobile phone.

Parameters

self: &Self

Returns

Option<bool>

is_smarttv

View source
fn is_smarttv(&self) -> Option<bool>

The client device is a smart TV.

Parameters

self: &Self

Returns

Option<bool>

is_tablet

View source
fn is_tablet(&self) -> Option<bool>

The client device is a tablet (like an iPad).

Parameters

self: &Self

Returns

Option<bool>

is_touchscreen

View source
fn is_touchscreen(&self) -> Option<bool>

The client device's screen is touch sensitive.

Parameters

self: &Self

Returns

Option<bool>

is_tvplayer

View source
fn is_tvplayer(&self) -> Option<bool>

The client device is a set-top box or other TV player (like a Roku or Apple TV).

Parameters

self: &Self

Returns

Option<bool>
fn model(&self) -> Option<&str>

The model of the client device.

Parameters

self: &Self

Returns

Option<&str>

os_major_version

View source
fn os_major_version(&self) -> Option<&str>

The client Operating System's major version in SemVer format.

x in x.y.z-a

Parameters

self: &Self

Returns

Option<&str>

os_minor_version

View source
fn os_minor_version(&self) -> Option<&str>

The client Operating System's major version in SemVer format.

y in x.y.z-a

Parameters

self: &Self

Returns

Option<&str>
fn os_name(&self) -> Option<&str>

The name of the Operating System the client is using.

Parameters

self: &Self

Returns

Option<&str>

os_patch_minor_version

View source
fn os_patch_minor_version(&self) -> Option<&str>

The client Operating System's patch-minor version in SemVer format.

a in x.y.z-a

Parameters

self: &Self

Returns

Option<&str>

os_patch_version

View source
fn os_patch_version(&self) -> Option<&str>

The client Operating System's patch version in SemVer format.

z in x.y.z-a

Parameters

self: &Self

Returns

Option<&str>

user_agent_bot_name

View source
fn user_agent_bot_name(&self) -> Option<&str>

The client identifies itself as a bot and provides a common name.

Parameters

self: &Self

Returns

Option<&str>

user_agent_major_version

View source
fn user_agent_major_version(&self) -> Option<&str>

The client's browser major version in SemVer fashion.

x in x.y.z

Parameters

self: &Self

Returns

Option<&str>

user_agent_minor_version

View source
fn user_agent_minor_version(&self) -> Option<&str>

The client's browser minor version in SemVer fashion.

y in x.y.z

Parameters

self: &Self

Returns

Option<&str>

user_agent_name

View source
fn user_agent_name(&self) -> Option<&str>

The name of the client's browser if known.

Parameters

self: &Self

Returns

Option<&str>

user_agent_patch_version

View source
fn user_agent_patch_version(&self) -> Option<&str>

The client's browser patch version in SemVer fashion.

z in x.y.z

Parameters

self: &Self

Returns

Option<&str>

Trait implementations

impl Debug for Device

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Parameters

self: &Self
f: &mut $crate::fmt::Formatter

Returns

$crate::fmt::Result

impl Deserialize for Device

deserialize

View source
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where
__D: Deserializer<'de>,

Parameters

__deserializer: __D

Returns

_serde::__private228::Result<Self, __D::Error>

impl Serialize for Device

serialize

View source
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where
__S: Serializer,

Parameters

self: &Self
__serializer: __S

Returns

_serde::__private228::Result<__S::Ok, __S::Error>

Auto trait implementations

Blanket implementations