[−][src]Struct twitter_stream::builder::BoundingBox
A BoundingBox is a rectangular area on the globe specified by coordinates of
the southwest and northeast edges in decimal degrees.
Fields
west_longitude: f64Longitude of the west side of the bounding box.
south_latitude: f64Latitude of the south side of the bounding box.
east_longitude: f64Longitude of the east side of the bounding box.
north_latitude: f64Latitude of the north side of the bounding box.
Implementations
impl BoundingBox[src]
pub const fn new(
west_longitude: f64,
south_latitude: f64,
east_longitude: f64,
north_latitude: f64
) -> Self[src]
west_longitude: f64,
south_latitude: f64,
east_longitude: f64,
north_latitude: f64
) -> Self
Creates a BoundingBox with the longitudes and latitudes of its sides.
Example
use twitter_stream::builder::BoundingBox; // Examples taken from Twitter's documentation. BoundingBox::new(-122.75, 36.8, -121.75, 37.8); // San Francisco BoundingBox::new(-74.0, 40.0, -73.0, 41.0); // New York City
pub fn unflatten_slice(slice: &[[f64; 4]]) -> &[Self][src]
Creates a slice of BoundingBox-es from a slice of arrays of
[west_longitude, south_latitude, east_longitude, north_latitude].
Examples
use twitter_stream::builder::BoundingBox; #[derive(serde::Deserialize)] struct Config { locations: Vec<[f64; 4]>, } let config = r#"{"locations": [[-122.75, 36.8, -121.75, 37.8]]}"#; let config: Config = serde_json::from_str(config).unwrap(); let locations = BoundingBox::unflatten_slice(&config.locations); assert_eq!(locations, [BoundingBox::new(-122.75, 36.8, -121.75, 37.8)]);
pub fn flatten_slice(bboxes: &[Self]) -> &[[f64; 4]][src]
Converts a slice of BoundingBox-es into a slice of arrays of
[west_longitude, south_latitude, east_longitude, north_latitude].
pub fn unflatten_vec(vec: Vec<[f64; 4]>) -> Vec<Self>[src]
Creates a vector of BoundingBox-es from a vector of arrays of
[west_longitude, south_latitude, east_longitude, north_latitude].
Examples
use twitter_stream::builder::BoundingBox; #[derive(serde::Deserialize)] struct Config { locations: Vec<[f64; 4]>, } let config = r#"{"locations": [[-122.75, 36.8, -121.75, 37.8]]}"#; let config: Config = serde_json::from_str(config).unwrap(); let locations = BoundingBox::unflatten_vec(config.locations); assert_eq!(locations, [BoundingBox::new(-122.75, 36.8, -121.75, 37.8)]);
pub fn flatten_vec(vec: Vec<Self>) -> Vec<[f64; 4]>[src]
Converts a vector of BoundingBox-es into a vector of arrays of
[west_longitude, south_latitude, east_longitude, north_latitude].
Trait Implementations
impl AsRef<[f64; 4]> for BoundingBox[src]
impl AsRef<BoundingBox> for [f64; 4][src]
fn as_ref(&self) -> &BoundingBox[src]
impl Clone for BoundingBox[src]
fn clone(&self) -> BoundingBox[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for BoundingBox[src]
impl Debug for BoundingBox[src]
impl From<[f64; 4]> for BoundingBox[src]
impl From<((f64, f64), (f64, f64))> for BoundingBox[src]
fn from(
((west_longitude, south_latitude), (east_longitude, north_latitude)): ((f64, f64), (f64, f64))
) -> Self[src]
((west_longitude, south_latitude), (east_longitude, north_latitude)): ((f64, f64), (f64, f64))
) -> Self
Creates a BoundingBox with two (longitude, latitude) pairs.
The first argument specifies the southwest edge and the latter specifies the northeast edge.
impl From<(f64, f64, f64, f64)> for BoundingBox[src]
fn from(
(west_longitude, south_latitude, east_longitude, north_latitude): (f64, f64, f64, f64)
) -> Self[src]
(west_longitude, south_latitude, east_longitude, north_latitude): (f64, f64, f64, f64)
) -> Self
impl From<BoundingBox> for [f64; 4][src]
fn from(bbox: BoundingBox) -> Self[src]
impl PartialEq<BoundingBox> for BoundingBox[src]
fn eq(&self, other: &BoundingBox) -> bool[src]
fn ne(&self, other: &BoundingBox) -> bool[src]
impl StructuralPartialEq for BoundingBox[src]
Auto Trait Implementations
impl RefUnwindSafe for BoundingBox
impl Send for BoundingBox
impl Sync for BoundingBox
impl Unpin for BoundingBox
impl UnwindSafe for BoundingBox
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T> Instrument for T[src]
fn instrument(self, span: Span) -> Instrumented<Self>[src]
fn in_current_span(self) -> Instrumented<Self>[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,