pub struct Center {
pub longitude: f64,
pub latitude: f64,
pub zoom: u8,
}
Fields§
§longitude: f64
§latitude: f64
§zoom: u8
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Center
impl<'de> Deserialize<'de> for Center
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for Center
impl Display for Center
source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Format center struct as a comma-separated string. Longitude and latitude are formatted with specified precision parameters.
let center = Center::new(1.5, -2.5, 8);
assert_eq!(center.to_string(), "1.5,-2.5,8");
assert_eq!(format!("{center:.2}"), "1.50,-2.50,8");
assert_eq!(Center::from_str(¢er.to_string()).unwrap(), center);
source§impl FromStr for Center
impl FromStr for Center
source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parse a string of four comma-separated values as a Center value,
same order as the Center::new
constructor. Extra spaces are ignored.
Example
let center = Center::from_str("1.0, 2.0, 3").unwrap();
assert_eq!(center, Center::new(1.0, 2.0, 3));
§type Err = ParseCenterError
type Err = ParseCenterError
The associated error which can be returned from parsing.
source§impl PartialEq for Center
impl PartialEq for Center
impl Copy for Center
impl StructuralPartialEq for Center
Auto Trait Implementations§
impl RefUnwindSafe for Center
impl Send for Center
impl Sync for Center
impl Unpin for Center
impl UnwindSafe for Center
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