From 224e748c71c16aec78bdfe51631bc4908dcccd08 Mon Sep 17 00:00:00 2001 From: Andrew Straw Date: Mon, 13 Jan 2025 14:01:12 +0100 Subject: [PATCH] more conversion from anyhow to eyre --- braid-april-cal/flytrax-apriltags-calibration/Cargo.toml | 2 +- .../src/bin/flytrax-apriltags-calibration.rs | 2 +- braid-april-cal/flytrax-apriltags-calibration/src/img_write.rs | 1 + braid-april-cal/flytrax-apriltags-calibration/src/lib.rs | 2 +- .../flytrax-apriltags-calibration/src/tiny_skia_frame.rs | 1 + .../tests/test-flytrax-apriltags.rs | 2 +- flytrax-csv-to-braidz/Cargo.toml | 2 +- flytrax-csv-to-braidz/src/bin/flytrax-csv-to-braidz.rs | 2 +- flytrax-csv-to-braidz/src/lib.rs | 1 + flytrax-csv-to-braidz/tests/tests.rs | 3 ++- strand-cam/flytrax-io/Cargo.toml | 2 +- strand-cam/flytrax-io/src/lib.rs | 2 +- 12 files changed, 13 insertions(+), 9 deletions(-) diff --git a/braid-april-cal/flytrax-apriltags-calibration/Cargo.toml b/braid-april-cal/flytrax-apriltags-calibration/Cargo.toml index bdb555bed..6c3b398fd 100644 --- a/braid-april-cal/flytrax-apriltags-calibration/Cargo.toml +++ b/braid-april-cal/flytrax-apriltags-calibration/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -anyhow.workspace = true +eyre.workspace = true base64.workspace = true clap.workspace = true image.workspace = true diff --git a/braid-april-cal/flytrax-apriltags-calibration/src/bin/flytrax-apriltags-calibration.rs b/braid-april-cal/flytrax-apriltags-calibration/src/bin/flytrax-apriltags-calibration.rs index 42f2529f5..c483e66b2 100644 --- a/braid-april-cal/flytrax-apriltags-calibration/src/bin/flytrax-apriltags-calibration.rs +++ b/braid-april-cal/flytrax-apriltags-calibration/src/bin/flytrax-apriltags-calibration.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; -use anyhow::Context; use clap::Parser; +use eyre::{self as anyhow, Context}; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] diff --git a/braid-april-cal/flytrax-apriltags-calibration/src/img_write.rs b/braid-april-cal/flytrax-apriltags-calibration/src/img_write.rs index 7b224faee..33d9e6bbd 100644 --- a/braid-april-cal/flytrax-apriltags-calibration/src/img_write.rs +++ b/braid-april-cal/flytrax-apriltags-calibration/src/img_write.rs @@ -1,3 +1,4 @@ +use eyre as anyhow; use std::io::Write; // This is lightly modified from the version in braid-process-video. diff --git a/braid-april-cal/flytrax-apriltags-calibration/src/lib.rs b/braid-april-cal/flytrax-apriltags-calibration/src/lib.rs index 22d410578..23cc04be2 100644 --- a/braid-april-cal/flytrax-apriltags-calibration/src/lib.rs +++ b/braid-april-cal/flytrax-apriltags-calibration/src/lib.rs @@ -1,7 +1,7 @@ use std::path::{Path, PathBuf}; -use anyhow::Context; use braid_april_cal::*; +use eyre::{self as anyhow, Context}; use flytrax_io::read_csv_commented_header; use machine_vision_formats::pixel_format::Mono8; use opencv_ros_camera::NamedIntrinsicParameters; diff --git a/braid-april-cal/flytrax-apriltags-calibration/src/tiny_skia_frame.rs b/braid-april-cal/flytrax-apriltags-calibration/src/tiny_skia_frame.rs index 9a682053b..510e72676 100644 --- a/braid-april-cal/flytrax-apriltags-calibration/src/tiny_skia_frame.rs +++ b/braid-april-cal/flytrax-apriltags-calibration/src/tiny_skia_frame.rs @@ -1,3 +1,4 @@ +use eyre as anyhow; use machine_vision_formats::{pixel_format::RGBA8, ImageBuffer, ImageBufferRef, ImageData, Stride}; pub(crate) struct Frame { diff --git a/braid-april-cal/flytrax-apriltags-calibration/tests/test-flytrax-apriltags.rs b/braid-april-cal/flytrax-apriltags-calibration/tests/test-flytrax-apriltags.rs index d6a311ea3..7aa261c8c 100644 --- a/braid-april-cal/flytrax-apriltags-calibration/tests/test-flytrax-apriltags.rs +++ b/braid-april-cal/flytrax-apriltags-calibration/tests/test-flytrax-apriltags.rs @@ -1,4 +1,4 @@ -use anyhow::{Context, Result}; +use eyre::{Context, Result}; use flytrax_apriltags_calibration::{compute_extrinsics, ComputeExtrinsicsArgs}; diff --git a/flytrax-csv-to-braidz/Cargo.toml b/flytrax-csv-to-braidz/Cargo.toml index 0b57603f9..f02dce973 100644 --- a/flytrax-csv-to-braidz/Cargo.toml +++ b/flytrax-csv-to-braidz/Cargo.toml @@ -20,7 +20,7 @@ lazy_static.workspace = true futures.workspace = true tokio.workspace = true tempfile.workspace = true -anyhow.workspace = true +eyre.workspace = true image.workspace = true opencv-ros-camera = { workspace = true, features = ["serde-serialize"] } diff --git a/flytrax-csv-to-braidz/src/bin/flytrax-csv-to-braidz.rs b/flytrax-csv-to-braidz/src/bin/flytrax-csv-to-braidz.rs index 7349bf9a0..e85f78431 100644 --- a/flytrax-csv-to-braidz/src/bin/flytrax-csv-to-braidz.rs +++ b/flytrax-csv-to-braidz/src/bin/flytrax-csv-to-braidz.rs @@ -1,7 +1,7 @@ #[macro_use] extern crate lazy_static; -use anyhow::Context; +use eyre::{self as anyhow, Context}; use tracing::info; use flydra_types::{MiniArenaConfig, XYGridConfig}; diff --git a/flytrax-csv-to-braidz/src/lib.rs b/flytrax-csv-to-braidz/src/lib.rs index 004e1f581..4f7e9ab33 100644 --- a/flytrax-csv-to-braidz/src/lib.rs +++ b/flytrax-csv-to-braidz/src/lib.rs @@ -5,6 +5,7 @@ use std::{ path::{Path, PathBuf}, }; +use eyre as anyhow; use serde::{Deserialize, Serialize}; use tracing::info; diff --git a/flytrax-csv-to-braidz/tests/tests.rs b/flytrax-csv-to-braidz/tests/tests.rs index 8cbbc2b3e..55c7f5c50 100644 --- a/flytrax-csv-to-braidz/tests/tests.rs +++ b/flytrax-csv-to-braidz/tests/tests.rs @@ -100,7 +100,8 @@ async fn test_z_values_zero() { } #[test(tokio::test)] -async fn mini_arenas_with_apriltags() -> anyhow::Result<()> { +#[cfg(feature = "with_apriltags")] +async fn mini_arenas_with_apriltags() -> eyre::Result<()> { const URL_BASE: &str = "https://strawlab-cdn.com/assets"; const CHECKERBOARD_CAL_FNAME: &str = "20230629-ob9-data/20230629_optobehav9_calibration.yaml"; diff --git a/strand-cam/flytrax-io/Cargo.toml b/strand-cam/flytrax-io/Cargo.toml index 014d084fa..436ad4fa0 100644 --- a/strand-cam/flytrax-io/Cargo.toml +++ b/strand-cam/flytrax-io/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -anyhow.workspace = true +eyre.workspace = true serde_yaml.workspace = true strand-cam-csv-config-types = { path = "../../strand-cam-csv-config-types" } diff --git a/strand-cam/flytrax-io/src/lib.rs b/strand-cam/flytrax-io/src/lib.rs index ee876fdd7..fe60ce4a6 100644 --- a/strand-cam/flytrax-io/src/lib.rs +++ b/strand-cam/flytrax-io/src/lib.rs @@ -1,6 +1,6 @@ use std::io::BufRead; -use anyhow::Result; +use eyre::{self as anyhow, Result}; use strand_cam_csv_config_types::FullCfgFview2_0_26;