Skip to main content

Viewport

Struct Viewport 

Source
#[non_exhaustive]
pub struct Viewport { pub low: Option<LatLng>, pub high: Option<LatLng>, /* private fields */ }
Expand description

A latitude-longitude viewport, represented as two diagonally opposite low and high points. A viewport is considered a closed region, i.e. it includes its boundary. The latitude bounds must range between -90 to 90 degrees inclusive, and the longitude bounds must range between -180 to 180 degrees inclusive. Various cases include:

  • If low = high, the viewport consists of that single point.

  • If low.longitude > high.longitude, the longitude range is inverted (the viewport crosses the 180 degree longitude line).

  • If low.longitude = -180 degrees and high.longitude = 180 degrees, the viewport includes all longitudes.

  • If low.longitude = 180 degrees and high.longitude = -180 degrees, the longitude range is empty.

  • If low.latitude > high.latitude, the latitude range is empty.

Both low and high must be populated, and the represented box cannot be empty (as specified by the definitions above). An empty viewport will result in an error.

For example, this viewport fully encloses New York City:

{ “low”: { “latitude”: 40.477398, “longitude”: -74.259087 }, “high”: { “latitude”: 40.91618, “longitude”: -73.70018 } }

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§low: Option<LatLng>

Required. The low point of the viewport.

§high: Option<LatLng>

Required. The high point of the viewport.

Implementations§

Source§

impl Viewport

Source

pub fn new() -> Self

Creates a new default instance.

Source

pub fn set_low<T>(self, v: T) -> Self
where T: Into<LatLng>,

Sets the value of low.

§Example
use google_cloud_type::model::LatLng;
let x = Viewport::new().set_low(LatLng::default()/* use setters */);
Source

pub fn set_or_clear_low<T>(self, v: Option<T>) -> Self
where T: Into<LatLng>,

Sets or clears the value of low.

§Example
use google_cloud_type::model::LatLng;
let x = Viewport::new().set_or_clear_low(Some(LatLng::default()/* use setters */));
let x = Viewport::new().set_or_clear_low(None::<LatLng>);
Source

pub fn set_high<T>(self, v: T) -> Self
where T: Into<LatLng>,

Sets the value of high.

§Example
use google_cloud_type::model::LatLng;
let x = Viewport::new().set_high(LatLng::default()/* use setters */);
Source

pub fn set_or_clear_high<T>(self, v: Option<T>) -> Self
where T: Into<LatLng>,

Sets or clears the value of high.

§Example
use google_cloud_type::model::LatLng;
let x = Viewport::new().set_or_clear_high(Some(LatLng::default()/* use setters */));
let x = Viewport::new().set_or_clear_high(None::<LatLng>);

Trait Implementations§

Source§

impl Clone for Viewport

Source§

fn clone(&self) -> Viewport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Viewport

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Viewport

Source§

fn default() -> Viewport

Returns the “default value” for a type. Read more
Source§

impl Message for Viewport

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Viewport

Source§

fn eq(&self, other: &Viewport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Viewport

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.