Skip to content

Commit

Permalink
Readd serde support
Browse files Browse the repository at this point in the history
Add rust-analyzer in correct version
  • Loading branch information
Tim Schubert authored and dadada committed Jun 7, 2023
1 parent c5a119f commit fc5e4c5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
let
pkgs = import nixpkgs { inherit system; };
rust-toolchain = with fenix.packages.${system}; combine [
rust-analyzer
stable.rust-analyzer
stable.cargo
stable.rustc
stable.rustfmt
Expand Down
3 changes: 3 additions & 0 deletions opentaws/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ is-it-maintained-open-issues = { repository = "aeronautical-informatics/openTAWS
maintenance = { status = "actively-developed" }

[features]
default = ["use-serde"]
use-serde = ["serde", "uom/use_serde"]

[dependencies]
serde = { version = "1.0", default-features = false, optional = true, features = ["derive"] }
lazy_static = { version = "1", default-features = false, features = [
"spin_no_std",
] }
Expand Down
3 changes: 2 additions & 1 deletion opentaws/src/aircraft_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct Normalized;
pub type NormalizedAircraftState = AircraftState<Normalized>;

/// Represents the current state of an aircraft
#[cfg_attr(feature = "use-serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, Default)]
pub struct AircraftState<T = ()> {
/// Time when this aircraft state was emitted
Expand Down Expand Up @@ -240,7 +241,6 @@ impl<T> AircraftState<T> {
}

fn wrap_position(lat: Angle, lon: Angle) -> (Angle, Angle) {
use ::uom::num_traits::Float;
let quadrant = ((lat.abs() / *QUARTER_REVOLUTION)
.get::<ratio::ratio>()
.floor() as i64)
Expand Down Expand Up @@ -337,6 +337,7 @@ AircrafState: {{
}

/// Represents a flight segment
#[cfg_attr(feature = "use-serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum FlightSegment {
/// The aircraft is in cruise flight situation
Expand Down
2 changes: 2 additions & 0 deletions opentaws/src/alerts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use heapless::FnvIndexMap;
use crate::prelude::*;

/// TAWS Alert levels
#[cfg_attr(feature = "use-serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum AlertLevel {
/// The level or category of alert for conditions that require immediate flight crew awareness
Expand All @@ -20,6 +21,7 @@ pub enum AlertLevel {
}

/// Represents a TAWS alert
#[cfg_attr(feature = "use-serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Alert<AlertSource: TawsAlertSource> {
/// The source resp. the TAWS functionallity which emitted this alert
Expand Down

0 comments on commit fc5e4c5

Please sign in to comment.