[−][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
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,