---
title: Geo
summary: The geographic data associated with a particular IP address.
url: https://www.fastly.com/documentation/reference/compute/sdks/rust/fastly/geo/struct.Geo/
---

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

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

The geographic data associated with a particular IP address.

## Methods

### area_code

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

```rust
fn area_code(&self) -> u16
```

The telephone area code associated with an IP address.

These are only available for IP addresses in the United States, its territories, and Canada.

**Parameters**

- `self`: `&Self`

**Returns**

`u16`

### as_name

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#189

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

The name of the organization associated with `as_number`.

For example, `fastly` is the value given for IP addresses under AS-54113.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### as_number

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

```rust
fn as_number(&self) -> u32
```

[Autonomous system](https://en.wikipedia.org/wiki/Autonomous_system_(Internet)) (AS) number.

**Parameters**

- `self`: `&Self`

**Returns**

`u32`

### city

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#206

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

City or town name.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### conn_speed

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#211

```rust
fn conn_speed(&self) -> ConnSpeed
```

Connection speed.

**Parameters**

- `self`: `&Self`

**Returns**

`ConnSpeed`

### conn_type

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#216

```rust
fn conn_type(&self) -> ConnType
```

Connection type.

**Parameters**

- `self`: `&Self`

**Returns**

`ConnType`

### continent

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#221

```rust
fn continent(&self) -> Continent
```

Continent.

**Parameters**

- `self`: `&Self`

**Returns**

`Continent`

### country_code

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#234

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

A two-character [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code for the country associated with an IP address.

The US country code is returned for IP addresses associated with overseas United States military bases.

These values include subdivisions that are assigned their own country codes in ISO
3166-1. For example, subdivisions NO-21 and NO-22 are presented with the country code SJ for
Svalbard and the Jan Mayen Islands.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### country_code3

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

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

A three-character [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country code for the country associated with the IP address.

The USA country code is returned for IP addresses associated with overseas United States
military bases.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### country_name

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#253

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

Country name.

This field is the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) English short name for a country.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### latitude

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#263

```rust
fn latitude(&self) -> f64
```

Latitude, in units of degrees from the equator.

Values range from -90.0 to +90.0 inclusive, and are based on the [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System) coordinate
reference system.

**Parameters**

- `self`: `&Self`

**Returns**

`f64`

### longitude

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#274

```rust
fn longitude(&self) -> f64
```

Longitude, in units of degrees from the [IERS Reference Meridian](https://en.wikipedia.org/wiki/IERS_Reference_Meridian).

Values range from -180.0 to +180.0 inclusive, and are based on the [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System)
coordinate reference system.

**Parameters**

- `self`: `&Self`

**Returns**

`f64`

### metro_code

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#279

```rust
fn metro_code(&self) -> i64
```

Metro code, representing designated market areas (DMAs) in the United States.

**Parameters**

- `self`: `&Self`

**Returns**

`i64`

### postal_code

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#291

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

The postal code associated with the IP address.

These are available for some IP addresses in Australia, Canada, France, Germany, Italy,
Spain, Switzerland, the United Kingdom, and the United States.

For Canadian postal codes, this is the first 3 characters. For the United Kingdom, this is
the first 2-4 characters (outward code). For countries with alphanumeric postal codes, this
field is a lowercase transliteration.

**Parameters**

- `self`: `&Self`

**Returns**

`&str`

### proxy_description

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#296

```rust
fn proxy_description(&self) -> ProxyDescription
```

Client proxy description.

**Parameters**

- `self`: `&Self`

**Returns**

`ProxyDescription`

### proxy_type

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#301

```rust
fn proxy_type(&self) -> ProxyType
```

Client proxy type.

**Parameters**

- `self`: `&Self`

**Returns**

`ProxyType`

### region

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#341

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

[ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) country subdivision code.

For countries with multiple levels of subdivision (for example, nations within the United
Kingdom), this variable gives the more specific subdivision.

This field can be `None` for countries that do not have ISO country subdivision codes. For
example, `None` is given for IP addresses assigned to the Åland Islands (country code AX,
illustrated below).

#### Examples

Region values are the subdivision part only. For typical use, a subdivision is normally
formatted with its associated country code. The following example illustrates constructing
an [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) two-part country and subdivision code from the respective fields:

```rust
let code = if let Some(region) = geo.region() {
    format!("{}-{}", geo.country_code(), region)
} else {
    format!("{}", geo.country_code())
};
```

| `code`     | Region Name       | Country            | ISO 3166-2 subdivision |
| ---------- | ----------------- | ------------------ | ---------------------- |
| `AX`       | Ödkarby           | Åland Islands      | (none)                 |
| `DE-BE`    | Berlin            | Germany            | Land (State)           |
| `GB-BNH`   | Brighton and Hove | United Kingdom     | Unitary authority      |
| `JP-13`    | 東京都 (Tōkyō-to)  | Japan              | Prefecture             |
| `RU-MOW`   | Москва́ (Moscow)   | Russian Federation | Federal city           |
| `SE-AB`    | Stockholms län    | Sweden             | Län (County)           |
| `US-CA`    | California        | United States      | State                  |

**Parameters**

- `self`: `&Self`

**Returns**

`Option<&str>`

### utc_offset

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#353

```rust
fn utc_offset(&self) -> Option<UtcOffset>
```

Time zone offset from coordinated universal time (UTC) for `city`.

This is represented using the [`UtcOffset`](https://docs.rs/time/latest/time/utc_offset/struct.UtcOffset.html) type from the [`time`](https://docs.rs/time/latest/time/index.html) library. See
`time`'s documentation for more details on how to format this type or use it in time
calculations.

Returns `None` if the geolocation database does not have a time zone offset for this IP
address.

**Parameters**

- `self`: `&Self`

**Returns**

`Option<UtcOffset>`

## Trait implementations

### impl Clone for Geo

#### clone

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#133

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

**Parameters**

- `self`: `&Self`

**Returns**

`Self`

### impl Debug for Geo

#### fmt

**Source:** https://docs.rs/crate/fastly/0.13.1/source/src/geo.rs#133

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

**Parameters**

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

**Returns**

`$crate::fmt::Result`

## Auto trait implementations

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

## Blanket implementations

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