Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherRabotin committed Aug 7, 2024
1 parent 110a178 commit 1aa0d03
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 115 deletions.
7 changes: 3 additions & 4 deletions src/cosmic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ pub trait TimeTagged {
pub trait State: Default + Copy + PartialEq + fmt::Display + fmt::LowerExp + Send + Sync
where
Self: Sized,
DefaultAllocator: Allocator< Self::Size>
+ Allocator< Self::Size, Self::Size>
+ Allocator< Self::VecLength>,
DefaultAllocator:
Allocator<Self::Size> + Allocator<Self::Size, Self::Size> + Allocator<Self::VecLength>,
{
/// Size of the state and its STM
type Size: DimName;
Expand Down Expand Up @@ -85,7 +84,7 @@ where
vector: &OVector<f64, Self::VecLength>,
) -> Self
where
DefaultAllocator: Allocator< Self::VecLength>,
DefaultAllocator: Allocator<Self::VecLength>,
{
self.set(self.epoch() + delta_t_s, vector);
self
Expand Down
2 changes: 1 addition & 1 deletion src/io/tracking_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl DynamicTrackingArc {
pub fn to_tracking_arc<Msr>(&self) -> Result<TrackingArc<Msr>, InputOutputError>
where
Msr: Measurement,
DefaultAllocator: Allocator< Msr::MeasurementSize>,
DefaultAllocator: Allocator<Msr::MeasurementSize>,
{
// Read the file since we closed it earlier
let file = File::open(&self.path).context(StdIOSnafu {
Expand Down
5 changes: 2 additions & 3 deletions src/io/trajectory_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ impl TrajectoryLoader {
pub fn to_traj<S>(&self) -> Result<Traj<S>, InputOutputError>
where
S: Interpolatable,
DefaultAllocator: Allocator< S::VecLength>
+ Allocator< S::Size>
+ Allocator< S::Size, S::Size>,
DefaultAllocator:
Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
// Check the schema
let mut has_epoch = false; // Required
Expand Down
15 changes: 5 additions & 10 deletions src/md/events/details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ pub enum EventEdge {
#[derive(Clone, Debug, PartialEq)]
pub struct EventDetails<S: Interpolatable>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
/// The state of the trajectory at the found event.
pub state: S,
Expand All @@ -70,8 +69,7 @@ where

impl<S: Interpolatable> EventDetails<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
/// Generates detailed information about an event at a specific epoch in a trajectory.
///
Expand Down Expand Up @@ -148,8 +146,7 @@ where

impl<S: Interpolatable> fmt::Display for EventDetails<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let prev_fmt = match self.prev_value {
Expand All @@ -173,17 +170,15 @@ where
#[derive(Clone, Debug, PartialEq)]
pub struct EventArc<S: Interpolatable>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
pub rise: EventDetails<S>,
pub fall: EventDetails<S>,
}

impl<S: Interpolatable> fmt::Display for EventArc<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
Expand Down
3 changes: 1 addition & 2 deletions src/md/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ use std::sync::Arc;
/// A trait to specify how a specific event must be evaluated.
pub trait EventEvaluator<S: State>: fmt::Display + Send + Sync
where
DefaultAllocator:
Allocator< S::Size> + Allocator< S::Size, S::Size> + Allocator< S::VecLength>,
DefaultAllocator: Allocator<S::Size> + Allocator<S::Size, S::Size> + Allocator<S::VecLength>,
{
// Evaluation of event crossing, must return whether the condition happened between between both states.
fn eval_crossing(
Expand Down
3 changes: 1 addition & 2 deletions src/md/events/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ use std::sync::Arc;

impl<S: Interpolatable> Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
/// Find the exact state where the request event happens. The event function is expected to be monotone in the provided interval because we find the event using a Brent solver.
#[allow(clippy::identity_op)]
Expand Down
5 changes: 2 additions & 3 deletions src/md/trajectory/interpolatable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ use enum_iterator::all;
pub trait Interpolatable: State
where
Self: Sized,
DefaultAllocator: Allocator< Self::Size>
+ Allocator< Self::Size, Self::Size>
+ Allocator< Self::VecLength>,
DefaultAllocator:
Allocator<Self::Size> + Allocator<Self::Size, Self::Size> + Allocator<Self::VecLength>,
{
/// Interpolates a new state at the provided epochs given a slice of states.
fn interpolate(self, epoch: Epoch, states: &[Self]) -> Result<Self, InterpolationError>;
Expand Down
24 changes: 8 additions & 16 deletions src/md/trajectory/traj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ use std::sync::Arc;
#[derive(Clone, PartialEq)]
pub struct Traj<S: Interpolatable>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
/// Optionally name this trajectory
pub name: Option<String>,
Expand All @@ -58,8 +57,7 @@ where

impl<S: Interpolatable> Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
pub fn new() -> Self {
Self {
Expand Down Expand Up @@ -518,8 +516,7 @@ where

impl<S: Interpolatable> ops::Add for Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
type Output = Result<Traj<S>, NyxError>;

Expand All @@ -531,8 +528,7 @@ where

impl<S: Interpolatable> ops::Add<&Traj<S>> for &Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
type Output = Result<Traj<S>, NyxError>;

Expand Down Expand Up @@ -578,8 +574,7 @@ where

impl<S: Interpolatable> ops::AddAssign<&Traj<S>> for Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
/// Attempt to add two trajectories together and assign it to `self`
///
Expand All @@ -593,8 +588,7 @@ where

impl<S: Interpolatable> fmt::Display for Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if self.states.is_empty() {
Expand All @@ -621,8 +615,7 @@ where

impl<S: Interpolatable> fmt::Debug for Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self}",)
Expand All @@ -631,8 +624,7 @@ where

impl<S: Interpolatable> Default for Traj<S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
fn default() -> Self {
Self::new()
Expand Down
6 changes: 2 additions & 4 deletions src/md/trajectory/traj_it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ use crate::time::TimeSeries;

pub struct TrajIterator<'a, S: Interpolatable>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
pub time_series: TimeSeries,
/// A shared pointer to the original trajectory.
Expand All @@ -33,8 +32,7 @@ where

impl<S: Interpolatable> Iterator for TrajIterator<'_, S>
where
DefaultAllocator:
Allocator< S::VecLength> + Allocator< S::Size> + Allocator< S::Size, S::Size>,
DefaultAllocator: Allocator<S::VecLength> + Allocator<S::Size> + Allocator<S::Size, S::Size>,
{
type Item = S;

Expand Down
12 changes: 6 additions & 6 deletions src/od/estimate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ pub use sc_uncertainty::SpacecraftUncertainty;
pub trait Estimate<T: State>
where
Self: Clone + PartialEq + Sized + fmt::Display,
DefaultAllocator: Allocator< <T as State>::Size>
+ Allocator< <T as State>::Size, <T as State>::Size>
+ Allocator< <T as State>::VecLength>,
DefaultAllocator: Allocator<<T as State>::Size>
+ Allocator<<T as State>::Size, <T as State>::Size>
+ Allocator<<T as State>::VecLength>,
{
/// An empty estimate. This is useful if wanting to store an estimate outside the scope of a filtering loop.
fn zeros(state: T) -> Self;
Expand Down Expand Up @@ -93,9 +93,9 @@ where
pub trait NavSolution<T>: Estimate<Spacecraft>
where
T: State,
DefaultAllocator: Allocator< <T as State>::Size>
+ Allocator< <T as State>::Size, <T as State>::Size>
+ Allocator< <T as State>::VecLength>,
DefaultAllocator: Allocator<<T as State>::Size>
+ Allocator<<T as State>::Size, <T as State>::Size>
+ Allocator<<T as State>::VecLength>,
{
fn orbital_state(&self) -> Orbit;
/// Returns the nominal state as computed by the dynamics
Expand Down
20 changes: 10 additions & 10 deletions src/od/filter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ where
A: DimName,
M: DimName,
T: State,
DefaultAllocator: Allocator< M>
+ Allocator< <T as State>::Size>
+ Allocator< <T as State>::VecLength>
+ Allocator< A>
+ Allocator< M, M>
+ Allocator< M, <T as State>::Size>
+ Allocator< <T as State>::Size, <T as State>::Size>
+ Allocator< A, A>
+ Allocator< <T as State>::Size, A>
+ Allocator< A, <T as State>::Size>,
DefaultAllocator: Allocator<M>
+ Allocator<<T as State>::Size>
+ Allocator<<T as State>::VecLength>
+ Allocator<A>
+ Allocator<M, M>
+ Allocator<M, <T as State>::Size>
+ Allocator<<T as State>::Size, <T as State>::Size>
+ Allocator<A, A>
+ Allocator<<T as State>::Size, A>
+ Allocator<A, <T as State>::Size>,
{
type Estimate: Estimate<T>;

Expand Down
22 changes: 11 additions & 11 deletions src/od/msr/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use parquet::arrow::ArrowWriter;
pub struct TrackingArc<Msr>
where
Msr: Measurement,
DefaultAllocator: Allocator< Msr::MeasurementSize>,
DefaultAllocator: Allocator<Msr::MeasurementSize>,
{
/// The YAML configuration to set up these devices
pub device_cfg: String,
Expand All @@ -56,8 +56,8 @@ where
impl<Msr> Display for TrackingArc<Msr>
where
Msr: Measurement,
DefaultAllocator: Allocator< Msr::MeasurementSize>
+ Allocator< Msr::MeasurementSize, Msr::MeasurementSize>,
DefaultAllocator:
Allocator<Msr::MeasurementSize> + Allocator<Msr::MeasurementSize, Msr::MeasurementSize>,
{
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
Expand All @@ -72,8 +72,8 @@ where
impl<Msr> TrackingArc<Msr>
where
Msr: Measurement,
DefaultAllocator: Allocator< Msr::MeasurementSize>
+ Allocator< Msr::MeasurementSize, Msr::MeasurementSize>,
DefaultAllocator:
Allocator<Msr::MeasurementSize> + Allocator<Msr::MeasurementSize, Msr::MeasurementSize>,
{
/// Store this tracking arc to a parquet file.
pub fn to_parquet_simple<P: AsRef<Path> + Debug>(
Expand Down Expand Up @@ -223,9 +223,9 @@ where
where
MsrIn: Interpolatable,
D: TrackingDeviceSim<MsrIn, Msr>,
DefaultAllocator: Allocator< <MsrIn as State>::Size>
+ Allocator< <MsrIn as State>::Size, <MsrIn as State>::Size>
+ Allocator< <MsrIn as State>::VecLength>,
DefaultAllocator: Allocator<<MsrIn as State>::Size>
+ Allocator<<MsrIn as State>::Size, <MsrIn as State>::Size>
+ Allocator<<MsrIn as State>::VecLength>,
{
let devices = D::loads_named(&self.device_cfg)?;

Expand Down Expand Up @@ -286,9 +286,9 @@ where
where
MsrIn: Interpolatable,
D: TrackingDeviceSim<MsrIn, Msr>,
DefaultAllocator: Allocator< <MsrIn as State>::Size>
+ Allocator< <MsrIn as State>::Size, <MsrIn as State>::Size>
+ Allocator< <MsrIn as State>::VecLength>,
DefaultAllocator: Allocator<<MsrIn as State>::Size>
+ Allocator<<MsrIn as State>::Size, <MsrIn as State>::Size>
+ Allocator<<MsrIn as State>::VecLength>,
{
let mut devices_map = BTreeMap::new();
let mut sampling_rates_ns = Vec::with_capacity(devices.len());
Expand Down
3 changes: 1 addition & 2 deletions src/od/msr/range_doppler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ impl EstimateFrom<Spacecraft, RangeDoppler> for Spacecraft {
transmitter: Orbit,
) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
where
DefaultAllocator:
Allocator< <RangeDoppler as Measurement>::MeasurementSize, Self::Size>,
DefaultAllocator: Allocator<<RangeDoppler as Measurement>::MeasurementSize, Self::Size>,
{
let delta_r = receiver.orbit.radius_km - transmitter.radius_km;
let delta_v = receiver.orbit.velocity_km_s - transmitter.velocity_km_s;
Expand Down
Loading

0 comments on commit 1aa0d03

Please sign in to comment.