diff --git a/satrs-example/src/lib.rs b/satrs-example/src/lib.rs index 5be45a9..34f6d0d 100644 --- a/satrs-example/src/lib.rs +++ b/satrs-example/src/lib.rs @@ -1,7 +1,7 @@ use std::net::Ipv4Addr; -use satrs_mib::resultcode; use satrs_mib::res_code::{ResultU16, ResultU16Info}; +use satrs_mib::resultcode; #[derive(Debug)] pub enum GroupId { diff --git a/satrs-mib/codegen/tests/verify_gen_struct.rs b/satrs-mib/codegen/tests/verify_gen_struct.rs index 675f6d6..ccd40e8 100644 --- a/satrs-mib/codegen/tests/verify_gen_struct.rs +++ b/satrs-mib/codegen/tests/verify_gen_struct.rs @@ -1,6 +1,6 @@ use satrs_core::res_code::ResultU16; -use satrs_mib::resultcode; use satrs_mib::res_code::ResultU16Info; +use satrs_mib::resultcode; #[resultcode(info = "This is a test result where the first parameter is foo")] const TEST_RESULT: ResultU16 = ResultU16::const_new(0, 1); diff --git a/satrs-mib/src/res_code.rs b/satrs-mib/src/res_code.rs index 8de5d2f..dabf939 100644 --- a/satrs-mib/src/res_code.rs +++ b/satrs-mib/src/res_code.rs @@ -57,38 +57,38 @@ impl From for ResultU16InfoSerializable { #[cfg(feature = "std")] pub mod stdmod { - use std::path::Path; - use std::io; use super::*; + use std::io; + use std::path::Path; pub fn print_resultcodes_as_csv(codes: &[ResultU16Info]) -> Result<(), csv::Error> { - let mut wtr = csv::Writer::from_writer(io::stdout()); - for result in codes { - wtr.serialize(ResultU16InfoSerializable::from(*result))?; + let mut wtr = csv::Writer::from_writer(io::stdout()); + for result in codes { + wtr.serialize(ResultU16InfoSerializable::from(*result))?; + } + wtr.flush()?; + Ok(()) + } + + pub fn write_resultcodes_to_csv( + results: &[ResultU16Info], + path: impl AsRef, + ) -> Result<(), csv::Error> { + let mut wtr = csv::Writer::from_path(path)?; + for result_code in results { + wtr.serialize(ResultU16InfoSerializable::from(*result_code))?; + } + wtr.flush()?; + Ok(()) } - wtr.flush()?; - Ok(()) } -pub fn write_resultcodes_to_csv( - results: &[ResultU16Info], - path: impl AsRef, -) -> Result<(), csv::Error> { - let mut wtr = csv::Writer::from_path(path)?; - for result_code in results { - wtr.serialize(ResultU16InfoSerializable::from(*result_code))?; - } - wtr.flush()?; - Ok(()) -} - -} #[cfg(test)] mod tests { use super::*; use std::fs::File; - use std::path::Path; use std::io::{BufRead, BufReader}; + use std::path::Path; // Special solution for this crate because the code generated by a macro will use // satrs_mib::res_code::* use crate as satrs_mib;