---
title: Device
summary: The device data associated with a particular User-Agent string.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/device_detection/struct.Device/
---

**Kind:** Struct  
**Module:** [device_detection](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/device_detection/)  
**Package:** fastly 0.13.1  
**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#64

```rust
pub struct Device { /* private fields */ }
```

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

## Methods

### brand

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#83

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#74

```rust
fn device_name(&self) -> Option<&str>
```

The name of the client device.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<&str>`

### hwtype

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#104

```rust
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>`

### is_bot

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#218

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#169

```rust
fn is_desktop(&self) -> Option<bool>
```

The client is a desktop web browser.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_downloader

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#223

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#112

```rust
fn is_ereader(&self) -> Option<bool>
```

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

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_feedreader

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#228

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#120

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#237

```rust
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`](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/device_detection/struct.Device/)
we have at least one property that is `Some(T)`.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_mediaplayer

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#129

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#137

```rust
fn is_mobile(&self) -> Option<bool>
```

The client device is a mobile phone.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_smarttv

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#145

```rust
fn is_smarttv(&self) -> Option<bool>
```

The client device is a smart TV.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_tablet

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#153

```rust
fn is_tablet(&self) -> Option<bool>
```

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

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_touchscreen

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#177

```rust
fn is_touchscreen(&self) -> Option<bool>
```

The client device's screen is touch sensitive.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<bool>`

### is_tvplayer

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#161

```rust
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>`

### model

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#91

```rust
fn model(&self) -> Option<&str>
```

The model of the client device.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<&str>`

### os_major_version

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#251

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#258

```rust
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>`

### os_name

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#244

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#272

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#265

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#213

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#194

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#201

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#187

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#208

```rust
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

#### fmt

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#63

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

**Parameters**

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

**Returns**

`$crate::fmt::Result`

### impl Deserialize for Device

#### deserialize

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#63

```rust
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

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/device_detection.rs#63

```rust
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

- `Freeze`
- `RefUnwindSafe`
- `Send`
- `Sync`
- `Unpin`
- `UnsafeUnpin`
- `UnwindSafe`

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `DeserializeOwned`
- `Downcast`
- `DowncastSync`
- `ErasedDestructor`
- `From<T>`
- `Into<U>`
- `IntoEither`
- `Same`
- `TryFrom<U>`
- `TryInto<U>`
