diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..05678a1 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,11 @@ +version = "Two" +use_field_init_shorthand = true +imports_granularity="Module" +wrap_comments = true +use_try_shorthand = true +format_code_in_doc_comments = true +format_strings = true +normalize_comments = true +normalize_doc_attributes = true +remove_nested_parens = true +reorder_impl_items = true diff --git a/src/info.rs b/src/info.rs index 1985e4d..6644b2c 100644 --- a/src/info.rs +++ b/src/info.rs @@ -1,7 +1,4 @@ -use crate::FromRpcResponse; -use crate::RequestError; -use crate::RequestResult; -use crate::TonicResult; +use crate::{FromRpcResponse, RequestError, RequestResult, TonicResult}; mod pb { tonic::include_proto!("mavsdk.rpc.info"); @@ -92,7 +89,7 @@ impl FromRpcResponse for GetVersionResult { } } -#[doc = " Provide infomation about the hardware and/or software of a system."] +/// Provide infomation about the hardware and/or software of a system. pub struct Info { service_client: pb::info_service_client::InfoServiceClient, } diff --git a/src/mocap.rs b/src/mocap.rs index fc963dd..2658ee3 100644 --- a/src/mocap.rs +++ b/src/mocap.rs @@ -1,7 +1,4 @@ -use crate::FromRpcResponse; -use crate::RequestError; -use crate::RequestResult; -use crate::TonicResult; +use crate::{FromRpcResponse, RequestError, RequestResult, TonicResult}; mod pb { tonic::include_proto!("mavsdk.rpc.mocap"); @@ -10,7 +7,8 @@ mod pb { /// Global position/attitude estimate from a vision source. #[derive(Default, Clone, PartialEq, Debug)] pub struct VisionPositionEstimate { - /// PositionBody frame timestamp UNIX Epoch time (0 to use Backend timestamp) + /// PositionBody frame timestamp UNIX Epoch time (0 to use Backend + /// timestamp) pub time_usec: u64, /// Global position (m) pub position_body: PositionBody, @@ -34,7 +32,8 @@ impl From for pb::VisionPositionEstimate { /// Motion capture attitude and position #[derive(Clone, PartialEq, Debug)] pub struct AttitudePosition { - /// PositionBody frame timestamp UNIX Epoch time (0 to use Backend timestamp) + /// PositionBody frame timestamp UNIX Epoch time (0 to use Backend + /// timestamp) pub time_usec: u64, /// Attitude quaternion (w, x, y, z order, zero-rotation is 1, 0, 0, 0) pub q: Quaternion, @@ -55,7 +54,8 @@ impl From for pb::AttitudePositionMocap { } } -/// Odometry message to communicate odometry mocaprmation with an external interface. +/// Odometry message to communicate odometry mocaprmation with an external +/// interface. #[derive(Clone, PartialEq, Debug)] pub struct Odometry { /// Timestamp (0 to use Backend timestamp). @@ -192,7 +192,6 @@ impl From for pb::Covariance { } } -/// /// Quaternion type. /// /// All rotations and axis systems follow the right-hand rule. @@ -280,9 +279,9 @@ impl FromRpcResponse for SetVisionPositio } } -#[doc = " Motion Capture allow vehicles to navigate when a global"] -#[doc = " position source is unavailable or unreliable"] -#[doc = " (e.g. indoors, or when flying under a bridge. etc.)."] +/// Motion Capture allow vehicles to navigate when a global +/// position source is unavailable or unreliable +/// (e.g. indoors, or when flying under a bridge. etc.). pub struct Mocap { service_client: pb::mocap_service_client::MocapServiceClient, } diff --git a/src/telemetry.rs b/src/telemetry.rs index b603701..3de1461 100644 --- a/src/telemetry.rs +++ b/src/telemetry.rs @@ -1,5 +1,4 @@ -use crate::RequestError; -use crate::RequestResult; +use crate::{RequestError, RequestResult}; use futures_util::stream::{Stream, StreamExt}; mod pb { @@ -12,8 +11,8 @@ pub enum MavFrame { /// Setpoint in body NED frame. This makes sense if all position control is /// externalized - e.g. useful to command 2 m/s^2 acceleration to the right. BodyNed = 8, - /// Odometry local coordinate frame of data given by a vision estimation system, - /// Z-down (x: north, y: east, z: down). + /// Odometry local coordinate frame of data given by a vision estimation + /// system, Z-down (x: north, y: east, z: down). VisionNed = 16, /// Odometry local coordinate frame of data given by an estimator running /// onboard the vehicle, Z-down (x: north, y: east, z: down). @@ -27,7 +26,8 @@ pub struct Odometry { pub time_usec: u64, /// Coordinate frame of reference for the pose data. pub frame_id: MavFrame, - /// Coordinate frame of reference for the velocity in free space (twist) data. + /// Coordinate frame of reference for the velocity in free space (twist) + /// data. pub child_frame_id: MavFrame, /// Position. pub position_body: PositionBody, @@ -165,7 +165,6 @@ impl From for pb::Covariance { } } -/// /// Quaternion type. /// /// All rotations and axis systems follow the right-hand rule. @@ -234,9 +233,9 @@ impl From for RequestError { } } -#[doc = ""] -#[doc = " Allow users to get vehicle telemetry and state information"] -#[doc = " (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry update rates."] +/// Allow users to get vehicle telemetry and state information +/// (e.g. battery, GPS, RC connection, flight mode etc.) and set telemetry +/// update rates. pub struct Telemetry { service_client: pb::telemetry_service_client::TelemetryServiceClient, }