[−][src]Struct address_formatter::Formatter
This Formatter holds all the configuration needed to format a Place
to a nice text.
The main method is the format method, that takes a Place
or something that can be converted to a Place and return a result with the formatted String
use address_formatter::Component::*; let formatter = address_formatter::Formatter::default(); let addr: address_formatter::Place = hashmap!( City => "Toulouse", Country => "France", CountryCode => "FR", County => "Toulouse", HouseNumber => "17", Neighbourhood => "Lafourguette", Postcode => "31000", Road => "Rue du Médecin-Colonel Calbairac", State => "Midi-Pyrénées", Suburb => "Toulouse Ouest", ).into(); assert_eq!( formatter.format(addr).unwrap(), r#"17 Rue du Médecin-Colonel Calbairac 31000 Toulouse France "# .to_owned() )
Methods
impl Formatter[src]
pub fn format(&self, into_addr: impl Into<Place>) -> Result<String, Error>[src]
make a human readable text from a Place
use address_formatter::Component::*; let formatter = address_formatter::Formatter::default(); let addr: address_formatter::Place = hashmap!( City => "Toulouse", Country => "France", CountryCode => "FR", County => "Toulouse", HouseNumber => "17", Neighbourhood => "Lafourguette", Postcode => "31000", Road => "Rue du Médecin-Colonel Calbairac", State => "Midi-Pyrénées", Suburb => "Toulouse Ouest", ).into(); assert_eq!( formatter.format(addr).unwrap(), r#"17 Rue du Médecin-Colonel Calbairac 31000 Toulouse France "# .to_owned() )
pub fn format_with_config(
&self,
into_addr: impl Into<Place>,
conf: Configuration
) -> Result<String, Error>[src]
&self,
into_addr: impl Into<Place>,
conf: Configuration
) -> Result<String, Error>
make a human readable text from a Place
Same as the format method,
but with a Configuration object
pub fn short_addr_format(
&self,
into_addr: impl Into<Place>
) -> Result<String, Error>[src]
&self,
into_addr: impl Into<Place>
) -> Result<String, Error>
make a human readable short text on 1 line with only the address Place
There is basically only the housenumber and the road
use address_formatter::Component::*; let formatter = address_formatter::Formatter::default(); let addr: address_formatter::Place = hashmap!( City => "Toulouse", Country => "France", CountryCode => "FR", County => "Toulouse", HouseNumber => "17", Neighbourhood => "Lafourguette", Postcode => "31000", Road => "Rue du Médecin-Colonel Calbairac", State => "Midi-Pyrénées", Suburb => "Toulouse Ouest", ).into(); assert_eq!( formatter.short_addr_format(addr).unwrap(), r#"17 Rue du Médecin-Colonel Calbairac"# .to_owned() )
pub fn short_addr_format_with_config(
&self,
into_addr: impl Into<Place>,
conf: Configuration
) -> Result<String, Error>[src]
&self,
into_addr: impl Into<Place>,
conf: Configuration
) -> Result<String, Error>
make a human readable short text on 1 line with only the address Place
Same as the short_addr_format method,
but with a Configuration object
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for 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<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,