From b0ef825e67df6f909637a91d41ac40911b673469 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Wed, 24 Jul 2019 23:37:26 +0300 Subject: [PATCH] Implement dc_location::new() and dc_kml_t::new() --- src/dc_location.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/dc_location.rs b/src/dc_location.rs index 123f768bc..6c61eca6a 100644 --- a/src/dc_location.rs +++ b/src/dc_location.rs @@ -28,6 +28,23 @@ pub struct dc_location { pub independent: uint32_t, } +impl dc_location { + pub fn new() -> Self { + dc_location { + location_id: 0, + latitude: 0.0, + longitude: 0.0, + accuracy: 0.0, + timestamp: 0, + contact_id: 0, + msg_id: 0, + chat_id: 0, + marker: std::ptr::null_mut(), + independent: 0, + } + } +} + #[derive(Copy, Clone)] #[repr(C)] pub struct dc_kml_t { @@ -37,6 +54,17 @@ pub struct dc_kml_t { pub curr: dc_location, } +impl dc_kml_t { + pub fn new() -> Self { + dc_kml_t { + addr: std::ptr::null_mut(), + locations: std::ptr::null_mut(), + tag: 0, + curr: dc_location::new(), + } + } +} + // location streaming pub unsafe fn dc_send_locations_to_chat( context: &Context,