pub enum AcsGeoidQuery {
State(Option<State>),
County(Option<State>, Option<County>),
CountySubdivision(State, Option<County>, Option<CountySubdivision>),
Place(Option<State>, Option<Place>),
CensusTract(State, Option<County>, Option<CensusTract>),
BlockGroup(State, Option<County>, Option<CensusTract>, Option<BlockGroup>),
}Expand description
enumeration representing the scopes of various ACS queries.
when running an ACS query at a given GEOID hierarchical level, there are a set
of required (aka, not Optional) components which can be coupled with Optional
(wildcard) components to construct a query.
Variants§
State(Option<State>)
County(Option<State>, Option<County>)
CountySubdivision(State, Option<County>, Option<CountySubdivision>)
Place(Option<State>, Option<Place>)
CensusTract(State, Option<County>, Option<CensusTract>)
BlockGroup(State, Option<County>, Option<CensusTract>, Option<BlockGroup>)
Implementations§
Source§impl AcsGeoidQuery
impl AcsGeoidQuery
Sourcepub fn new(
geoid: Option<Geoid>,
wildcard: Option<GeoidType>,
) -> Result<AcsGeoidQuery, String>
pub fn new( geoid: Option<Geoid>, wildcard: Option<GeoidType>, ) -> Result<AcsGeoidQuery, String>
§Examples
when no wildcard is provided, the query is constructed for an exact location, which should return a single result.
use bamcensus_core::model::identifier::{fips, Geoid, GeoidType};
use bamcensus_acs::model::AcsGeoidQuery;;
let geoid = Geoid::County(fips::State(8), fips::County(1));
let query = AcsGeoidQuery::new(Some(geoid), None).unwrap();
let key = query.to_query_key();
assert_eq!(key, String::from("&for=county:001&in=state:08"));some combinations simply append a wildcard one level below the geoid, for example, tacking a county=* on top of state=08.
use bamcensus_core::model::identifier::{fips, Geoid, GeoidType};
use bamcensus_acs::model::AcsGeoidQuery;;
let geoid = Geoid::State(fips::State(8));
let wildcard = GeoidType::County;
let query = AcsGeoidQuery::new(Some(geoid), Some(wildcard)).unwrap();
let key = query.to_query_key();
assert_eq!(key, String::from("&for=county:*&in=state:08"));some interpolate the wildcard into a geoid in ways that do not require being reported in the query, such as adding a wildcard to a tract query. in this case, the query simply drops the county wildcard, as it is implied.
use bamcensus_core::model::identifier::{fips, Geoid, GeoidType};
use bamcensus_acs::model::AcsGeoidQuery;;
let geoid = Geoid::CensusTract(fips::State(8), fips::County(1), fips::CensusTract(1));
let wildcard = GeoidType::County;
let query = AcsGeoidQuery::new(Some(geoid), Some(wildcard)).unwrap();
let key = query.to_query_key();
assert_eq!(key, String::from("&for=tract:000001&in=state:08"));§Returns
URL query string for calls to the US Census ACS API “for” section, which set the spatial scope and granularity of the query result.
Sourcepub fn to_query_key(&self) -> String
pub fn to_query_key(&self) -> String
a query key for a unique data row in the census API. depending on the AcsGeoidQuery and the presence/absence of FIPS values, wildcards (“*”) will be inserted at any level.
pub fn response_geoid_type(&self) -> GeoidType
pub fn response_column_names(&self) -> Vec<String>
pub fn response_column_count(&self) -> usize
pub fn get_geoid_type(&self) -> GeoidType
Sourcepub fn build_deserialize_geoid_fn(&self) -> DeserializeGeoidFn
pub fn build_deserialize_geoid_fn(&self) -> DeserializeGeoidFn
builds a function that unpacks the ACS query values representing a geoid. these return as values in an array of different lengths, depending on the scope of the original query.
Trait Implementations§
Source§impl Clone for AcsGeoidQuery
impl Clone for AcsGeoidQuery
Source§fn clone(&self) -> AcsGeoidQuery
fn clone(&self) -> AcsGeoidQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AcsGeoidQuery
impl RefUnwindSafe for AcsGeoidQuery
impl Send for AcsGeoidQuery
impl Sync for AcsGeoidQuery
impl Unpin for AcsGeoidQuery
impl UnsafeUnpin for AcsGeoidQuery
impl UnwindSafe for AcsGeoidQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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