libshumate/auto/
coordinate.rs1use crate::{Location, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 #[doc(alias = "ShumateCoordinate")]
16 pub struct Coordinate(Object<ffi::ShumateCoordinate, ffi::ShumateCoordinateClass>) @implements Location;
17
18 match fn {
19 type_ => || ffi::shumate_coordinate_get_type(),
20 }
21}
22
23impl Coordinate {
24 pub const NONE: Option<&'static Coordinate> = None;
25
26 #[doc(alias = "shumate_coordinate_new")]
32 pub fn new() -> Coordinate {
33 assert_initialized_main_thread!();
34 unsafe { from_glib_none(ffi::shumate_coordinate_new()) }
35 }
36
37 #[doc(alias = "shumate_coordinate_new_full")]
48 pub fn new_full(latitude: f64, longitude: f64) -> Coordinate {
49 assert_initialized_main_thread!();
50 unsafe { from_glib_none(ffi::shumate_coordinate_new_full(latitude, longitude)) }
51 }
52
53 pub fn builder() -> CoordinateBuilder {
58 CoordinateBuilder::new()
59 }
60}
61
62impl Default for Coordinate {
63 fn default() -> Self {
64 Self::new()
65 }
66}
67
68#[must_use = "The builder must be built to be used"]
73pub struct CoordinateBuilder {
74 builder: glib::object::ObjectBuilder<'static, Coordinate>,
75}
76
77impl CoordinateBuilder {
78 fn new() -> Self {
79 Self {
80 builder: glib::object::Object::builder(),
81 }
82 }
83
84 pub fn latitude(self, latitude: f64) -> Self {
86 Self {
87 builder: self.builder.property("latitude", latitude),
88 }
89 }
90
91 pub fn longitude(self, longitude: f64) -> Self {
93 Self {
94 builder: self.builder.property("longitude", longitude),
95 }
96 }
97
98 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
101 pub fn build(self) -> Coordinate {
102 assert_initialized_main_thread!();
103 self.builder.build()
104 }
105}