pub struct FIPSCode(/* private fields */);Expand description
Encodes a hierarchical FIPS geographic region code in 64 bits. Excludes the nonhierarchical codes places, congressional or state legislative districts, and ZIP code tabulation areas. (See the module level documentation.)
Implementations§
Source§impl FIPSCode
impl FIPSCode
Sourcepub fn with_state(state: USState) -> Self
pub fn with_state(state: USState) -> Self
Sourcepub fn with_state_code(state_code: StateCode) -> Result<Self, FIPSError>
pub fn with_state_code(state_code: StateCode) -> Result<Self, FIPSError>
Constructs a new FIPSCode.
Returns Err(()) if the data provided is out of range.
Sourcepub fn with_county(
state: StateCode,
county: CountyCode,
) -> Result<Self, FIPSError>
pub fn with_county( state: StateCode, county: CountyCode, ) -> Result<Self, FIPSError>
Constructs a new FIPSCode.
Returns Err(()) if the data provided is out of range.
Sourcepub fn with_tract(
state: StateCode,
county: CountyCode,
tract: TractCode,
) -> Result<Self, FIPSError>
pub fn with_tract( state: StateCode, county: CountyCode, tract: TractCode, ) -> Result<Self, FIPSError>
Constructs a new FIPSCode.
Returns Err(()) if the data provided is out of range.
Sourcepub fn with_category(
state: StateCode,
county: CountyCode,
tract: TractCode,
category: SettingCategoryCode,
) -> Result<Self, FIPSError>
pub fn with_category( state: StateCode, county: CountyCode, tract: TractCode, category: SettingCategoryCode, ) -> Result<Self, FIPSError>
Constructs a new FIPSCode.
Returns Err(()) if the data provided is out of range.
pub fn new( state: StateCode, county: CountyCode, tract: TractCode, category: SettingCategoryCode, id: IdCode, data: DataCode, ) -> Result<Self, FIPSError>
Sourcepub fn state(&self) -> Result<USState, FIPSError>
pub fn state(&self) -> Result<USState, FIPSError>
Returns the FIPS STATE as a USState enum variant.
Returns Err(()) if USState cannot represent the state code. Use FIPSCode::state_code() to
retrieve the state code in this case.
Sourcepub fn state_code(&self) -> StateCode
pub fn state_code(&self) -> StateCode
Returns the FIPS STATE code as a StateCode (a u8)
Sourcepub fn county_code(&self) -> CountyCode
pub fn county_code(&self) -> CountyCode
Returns the numeric FIPS COUNTY code
Sourcepub fn census_tract_code(&self) -> TractCode
pub fn census_tract_code(&self) -> TractCode
Returns the numeric FIPS CENSUS TRACT code
Sourcepub fn category_code(&self) -> SettingCategoryCode
pub fn category_code(&self) -> SettingCategoryCode
Returns the numeric SETTING CATEGORY code
Sourcepub fn set_state(&self, state: USState) -> Self
pub fn set_state(&self, state: USState) -> Self
Creates a copy of self with the FIPS STATE set to state.
Sourcepub fn set_state_code(&self, state_code: StateCode) -> Result<Self, FIPSError>
pub fn set_state_code(&self, state_code: StateCode) -> Result<Self, FIPSError>
Creates a copy of self with the FIPS STATE set to state.
Sourcepub fn set_county(&self, county: CountyCode) -> Result<Self, FIPSError>
pub fn set_county(&self, county: CountyCode) -> Result<Self, FIPSError>
Creates a copy of self with the FIPS COUNTY set to county.
Sourcepub fn set_tract(&self, tract: TractCode) -> Result<Self, FIPSError>
pub fn set_tract(&self, tract: TractCode) -> Result<Self, FIPSError>
Creates a copy of self with the FIPS CENSUS TRACT set to tract.
Sourcepub fn set_category(
&self,
category: SettingCategoryCode,
) -> Result<Self, FIPSError>
pub fn set_category( &self, category: SettingCategoryCode, ) -> Result<Self, FIPSError>
Creates a copy of self with the setting category set to category.
Sourcepub fn set_id(&self, id: IdCode) -> Result<Self, FIPSError>
pub fn set_id(&self, id: IdCode) -> Result<Self, FIPSError>
Creates a copy of self with the ID number set to id.
Sourcepub fn set_data(&self, data: DataCode) -> Result<Self, FIPSError>
pub fn set_data(&self, data: DataCode) -> Result<Self, FIPSError>
Creates a copy of self with the unused data region set to data.
Sourcepub fn set_data_in_place(&mut self, data: DataCode) -> Result<(), FIPSError>
pub fn set_data_in_place(&mut self, data: DataCode) -> Result<(), FIPSError>
Sets the unused data region occupying the 10 LSB in place.
Returns Ok(()) if data is in range, Err(FIPSError) otherwise.
Sourcepub fn compare_non_data(&self, other: Self) -> Ordering
pub fn compare_non_data(&self, other: Self) -> Ordering
Compares the given values without respect to the data region (the Least Significant Bits). Use the usual
equality operators for comparing FIPSCodes including the data region.