pub struct JSONCollectionReader<M: Clone = (), P: Clone + Default = Properties, D: Clone + Default = MValue> {
pub features: Vec<VectorFeature<M, P, D>>,
}Expand description
§JSON Collection Reader
§Description
Parse (Geo|S2)JSON.
Data parsed using the ToGisJSON trait can be coerced into this struct
Implements the FeatureReader trait
§Usage
use gistools::{parsers::FeatureReader, readers::{ToGisJSON, JSONCollectionReader}};
use s2json::{MValue, MValueCompatible, Feature};
use serde::{Deserialize, Serialize};
#[derive(Debug, Default, Clone, PartialEq, MValueCompatible, Serialize, Deserialize)]
struct Test {
name: String,
}
let json_str = r#"{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [100.0, 0.0]
},
"properties": {
"name": "Tokyo"
}
}"#;
let mut json: Feature<(), Test, MValue> = json_str.to_feature().unwrap();
let collection = JSONCollectionReader::from(&mut json);
let features: Vec<_> = collection.iter().collect();
assert_eq!(features.len(), 1);Fields§
§features: Vec<VectorFeature<M, P, D>>Collection of features
Implementations§
Trait Implementations§
Source§impl<M: Clone + Clone, P: Clone + Clone + Default, D: Clone + Clone + Default> Clone for JSONCollectionReader<M, P, D>
impl<M: Clone + Clone, P: Clone + Clone + Default, D: Clone + Clone + Default> Clone for JSONCollectionReader<M, P, D>
Source§fn clone(&self) -> JSONCollectionReader<M, P, D>
fn clone(&self) -> JSONCollectionReader<M, P, D>
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<M: Debug + Clone, P: Debug + Clone + Default, D: Debug + Clone + Default> Debug for JSONCollectionReader<M, P, D>
impl<M: Debug + Clone, P: Debug + Clone + Default, D: Debug + Clone + Default> Debug for JSONCollectionReader<M, P, D>
Source§impl<M: Clone + DeserializeOwned, P: Clone + Default + DeserializeOwned, D: Clone + Default + DeserializeOwned> FeatureReader<M, P, D> for JSONCollectionReader<M, P, D>
A feature reader trait with a callback-based approach
impl<M: Clone + DeserializeOwned, P: Clone + Default + DeserializeOwned, D: Clone + Default + DeserializeOwned> FeatureReader<M, P, D> for JSONCollectionReader<M, P, D>
A feature reader trait with a callback-based approach
Source§type FeatureIterator<'a> = JSONCollectionIterator<'a, M, P, D>
where
M: 'a,
P: 'a,
D: 'a
type FeatureIterator<'a> = JSONCollectionIterator<'a, M, P, D> where M: 'a, P: 'a, D: 'a
The Feature Reader should implement an iterator of some kind
Source§fn iter(&self) -> Self::FeatureIterator<'_>
fn iter(&self) -> Self::FeatureIterator<'_>
All readers have an iter function that returns a Iterator struct
Source§impl<M: Clone, P: Clone + Default, D: Clone + Default> From<&mut Feature<M, P, D>> for JSONCollectionReader<M, P, D>
impl<M: Clone, P: Clone + Default, D: Clone + Default> From<&mut Feature<M, P, D>> for JSONCollectionReader<M, P, D>
Source§fn from(feature: &mut Feature<M, P, D>) -> JSONCollectionReader<M, P, D>
fn from(feature: &mut Feature<M, P, D>) -> JSONCollectionReader<M, P, D>
Converts to this type from the input type.
Source§impl<M: Clone + Default, P: Clone + Default, D: Clone + Default> From<&mut FeatureCollection<M, P, D>> for JSONCollectionReader<M, P, D>
impl<M: Clone + Default, P: Clone + Default, D: Clone + Default> From<&mut FeatureCollection<M, P, D>> for JSONCollectionReader<M, P, D>
Source§fn from(
collection: &mut FeatureCollection<M, P, D>,
) -> JSONCollectionReader<M, P, D>
fn from( collection: &mut FeatureCollection<M, P, D>, ) -> JSONCollectionReader<M, P, D>
Converts to this type from the input type.
Source§impl<M: Clone, P: Clone + Default, D: Clone + Default> From<&mut JSONCollection<M, P, D>> for JSONCollectionReader<M, P, D>
impl<M: Clone, P: Clone + Default, D: Clone + Default> From<&mut JSONCollection<M, P, D>> for JSONCollectionReader<M, P, D>
Source§fn from(collection: &mut JSONCollection<M, P, D>) -> Self
fn from(collection: &mut JSONCollection<M, P, D>) -> Self
Converts to this type from the input type.
Source§impl<M: Clone + Default, P: Clone + Default, D: Clone + Default> From<&mut S2FeatureCollection<M, P, D>> for JSONCollectionReader<M, P, D>
impl<M: Clone + Default, P: Clone + Default, D: Clone + Default> From<&mut S2FeatureCollection<M, P, D>> for JSONCollectionReader<M, P, D>
Source§fn from(
collection: &mut S2FeatureCollection<M, P, D>,
) -> JSONCollectionReader<M, P, D>
fn from( collection: &mut S2FeatureCollection<M, P, D>, ) -> JSONCollectionReader<M, P, D>
Converts to this type from the input type.
Source§impl<M: Clone, P: Clone + Default, D: Clone + Default> From<&mut VectorFeature<M, P, D>> for JSONCollectionReader<M, P, D>
impl<M: Clone, P: Clone + Default, D: Clone + Default> From<&mut VectorFeature<M, P, D>> for JSONCollectionReader<M, P, D>
Source§fn from(
collection: &mut VectorFeature<M, P, D>,
) -> JSONCollectionReader<M, P, D>
fn from( collection: &mut VectorFeature<M, P, D>, ) -> JSONCollectionReader<M, P, D>
Converts to this type from the input type.
Source§impl<M: Clone, P: Clone + Default, D: Clone + Default> IntoIterator for JSONCollectionReader<M, P, D>
impl<M: Clone, P: Clone + Default, D: Clone + Default> IntoIterator for JSONCollectionReader<M, P, D>
Source§type Item = VectorFeature<M, P, D>
type Item = VectorFeature<M, P, D>
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<<JSONCollectionReader<M, P, D> as IntoIterator>::Item>
type IntoIter = IntoIter<<JSONCollectionReader<M, P, D> as IntoIterator>::Item>
Which kind of iterator are we turning this into?
Auto Trait Implementations§
impl<M, P, D> Freeze for JSONCollectionReader<M, P, D>
impl<M, P, D> RefUnwindSafe for JSONCollectionReader<M, P, D>
impl<M, P, D> Send for JSONCollectionReader<M, P, D>
impl<M, P, D> Sync for JSONCollectionReader<M, P, D>
impl<M, P, D> Unpin for JSONCollectionReader<M, P, D>
impl<M, P, D> UnwindSafe for JSONCollectionReader<M, P, D>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more