Skip to content

Commit

Permalink
Refactor/rustfmt (#24)
Browse files Browse the repository at this point in the history
* add rustfmt config file

* apply formatting
  • Loading branch information
danieleades authored Nov 4, 2023
1 parent 38c9aa6 commit a47fc92
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
11 changes: 11 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions src/info.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -92,7 +89,7 @@ impl FromRpcResponse<pb::GetVersionResponse> 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<tonic::transport::Channel>,
}
Expand Down
21 changes: 10 additions & 11 deletions src/mocap.rs
Original file line number Diff line number Diff line change
@@ -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");
Expand All @@ -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,
Expand All @@ -34,7 +32,8 @@ impl From<VisionPositionEstimate> 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,
Expand All @@ -55,7 +54,8 @@ impl From<AttitudePosition> 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).
Expand Down Expand Up @@ -192,7 +192,6 @@ impl From<Covariance> for pb::Covariance {
}
}

///
/// Quaternion type.
///
/// All rotations and axis systems follow the right-hand rule.
Expand Down Expand Up @@ -280,9 +279,9 @@ impl FromRpcResponse<pb::SetVisionPositionEstimateResponse> 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<tonic::transport::Channel>,
}
Expand Down
17 changes: 8 additions & 9 deletions src/telemetry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::RequestError;
use crate::RequestResult;
use crate::{RequestError, RequestResult};
use futures_util::stream::{Stream, StreamExt};

mod pb {
Expand All @@ -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).
Expand All @@ -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,
Expand Down Expand Up @@ -165,7 +165,6 @@ impl From<Covariance> for pb::Covariance {
}
}

///
/// Quaternion type.
///
/// All rotations and axis systems follow the right-hand rule.
Expand Down Expand Up @@ -234,9 +233,9 @@ impl From<Error> for RequestError<Error> {
}
}

#[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<tonic::transport::Channel>,
}
Expand Down

0 comments on commit a47fc92

Please sign in to comment.