---
title: Name
summary: A section of a Mime.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/mime/struct.Name/
---

**Kind:** Struct  
**Module:** [mime](https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/mime/)  
**Package:** fastly 0.13.1

```rust
pub struct Name<'a> { /* private fields */ }
```

A section of a `Mime`.

For instance, for the Mime `image/svg+xml`, it contains 3 `Name`s,
`image`, `svg`, and `xml`.

In most cases, `Name`s are compared ignoring case.

## Methods

### as_str

```rust
fn as_str(&self) -> &'a str
```

Get the value of this `Name` as a string.

Note that the borrow is not tied to `&self` but the `'a` lifetime, allowing the
string to outlive `Name`. Alternately, there is an `impl<'a> From<Name<'a>> for &'a str`
which isn't rendered by Rustdoc, that can be accessed using `str::from(name)` or `name.into()`.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

## Trait implementations

### impl AsRef<str> for Name

#### as_ref

```rust
fn as_ref(&self) -> &str
```

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### impl Clone for Name

#### clone

```rust
fn clone(&self) -> Self
```

**Parameters**

- `self`: `&Self`

**Returns**

`Self`

### impl Debug for Name

#### fmt

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

**Parameters**

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

**Returns**

`fmt::Result`

### impl Display for Name

#### fmt

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

**Parameters**

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

**Returns**

`fmt::Result`

### impl Hash for Name

#### hash

```rust
fn hash<__H: Hasher>(&self, state: &mut __H)
```

**Parameters**

- `self`: `&Self`
- `state`: `&mut __H`

### impl Ord for Name

#### cmp

```rust
fn cmp(&self, other: &Self) -> Ordering
```

**Parameters**

- `self`: `&Self`
- `other`: `&Self`

**Returns**

`$crate::cmp::Ordering`

### impl PartialEq for Name

#### eq

```rust
fn eq(&self, other: &Self) -> bool
```

**Parameters**

- `self`: `&Self`
- `other`: `&Self`

**Returns**

`bool`

### impl PartialEq<&str> for Name

#### eq

```rust
fn eq(&self, other: &&'b str) -> bool
```

**Parameters**

- `self`: `&Self`
- `other`: `&&str`

**Returns**

`bool`

### impl PartialOrd for Name

#### partial_cmp

```rust
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
```

**Parameters**

- `self`: `&Self`
- `other`: `&Self`

**Returns**

`$crate::option::Option<$crate::cmp::Ordering>`

## Auto trait implementations

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

## Blanket implementations

- `Any`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `From<T>`
- `Into<U>`
- `ToOwned`
- `ToString`
- `TryFrom<U>`
- `TryInto<U>`
