pub struct Municipio {
pub ibge_code: u32,
pub name: &'static str,
pub state: State,
}Fields§
§ibge_code: u32IBGE 7-digit code.
name: &'static strMunicipality name.
state: StateState this municipality belongs to.
Implementations§
Source§impl Municipio
impl Municipio
Sourcepub fn from_ibge_code(code: u32) -> Option<&'static Municipio>
pub fn from_ibge_code(code: u32) -> Option<&'static Municipio>
Find a municipality by its IBGE code.
Sourcepub fn capital_of(state: State) -> &'static Municipio
pub fn capital_of(state: State) -> &'static Municipio
Get the capital of a given state.
Sourcepub fn by_state(state: State) -> &'static [Municipio]
pub fn by_state(state: State) -> &'static [Municipio]
Returns all municipalities in a given state.
Efficient: exploits the fact that ALL is sorted by state.
Sourcepub fn search_by_name(query: &str) -> impl Iterator<Item = &'static Municipio>
pub fn search_by_name(query: &str) -> impl Iterator<Item = &'static Municipio>
Find municipalities whose name contains the given substring (case-insensitive).
pub fn is_capital(&self) -> bool
Trait Implementations§
impl Copy for Municipio
impl Eq for Municipio
impl StructuralPartialEq for Municipio
Auto Trait Implementations§
impl Freeze for Municipio
impl RefUnwindSafe for Municipio
impl Send for Municipio
impl Sync for Municipio
impl Unpin for Municipio
impl UnsafeUnpin for Municipio
impl UnwindSafe for Municipio
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
Mutably borrows from an owned value. Read more