this structure is a lot better
This commit is contained in:
parent
489686c8ce
commit
fd59f25fea
27
Cargo.lock
generated
27
Cargo.lock
generated
@ -715,35 +715,34 @@ dependencies = [
|
||||
"csv",
|
||||
"delegate 0.8.0",
|
||||
"satrs-core",
|
||||
"satrs-macros",
|
||||
"satrs-mib",
|
||||
"spacepackets",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "satrs-macros"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"satrs-core",
|
||||
"satrs-mib",
|
||||
"syn",
|
||||
"trybuild",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "satrs-mib"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"csv",
|
||||
"satrs-core",
|
||||
"satrs-macros",
|
||||
"satrs-mib-codegen",
|
||||
"serde",
|
||||
"serde-hex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "satrs-mib-codegen"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"satrs-core",
|
||||
"satrs-mib",
|
||||
"syn",
|
||||
"trybuild",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
|
@ -14,9 +14,6 @@ csv = "1"
|
||||
[dependencies.spacepackets]
|
||||
path = "../spacepackets"
|
||||
|
||||
[dependencies.satrs-macros]
|
||||
path = "../satrs-macros"
|
||||
|
||||
[dependencies.satrs-core]
|
||||
path = "../satrs-core"
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
use std::net::Ipv4Addr;
|
||||
|
||||
use satrs_core::res_code::ResultU16;
|
||||
use satrs_macros::resultcode;
|
||||
use satrs_mib::res_code::ResultU16Info;
|
||||
use satrs_mib::resultcode;
|
||||
use satrs_mib::res_code::{ResultU16, ResultU16Info};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum GroupId {
|
||||
|
@ -7,17 +7,21 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
serde-hex = "0.1.0"
|
||||
csv = "1"
|
||||
|
||||
[dependencies.csv]
|
||||
version = "1"
|
||||
optional = true
|
||||
|
||||
[dependencies.satrs-core]
|
||||
path = "../satrs-core"
|
||||
|
||||
[dependencies.satrs-macros]
|
||||
path = "../satrs-macros"
|
||||
|
||||
[dependencies.satrs-mib-codegen]
|
||||
path = "codegen"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
default-features = false
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["csv", "serde/std"]
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! Basic check which just verifies that everything compiles
|
||||
use satrs_core::res_code::ResultU16;
|
||||
use satrs_macros::*;
|
||||
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);
|
||||
|
@ -1,5 +1,5 @@
|
||||
use satrs_core::res_code::ResultU16;
|
||||
use satrs_macros::*;
|
||||
use satrs_mib::resultcode;
|
||||
use satrs_mib::res_code::ResultU16Info;
|
||||
|
||||
#[resultcode(info = "This is a test result where the first parameter is foo")]
|
||||
|
@ -1,2 +1,8 @@
|
||||
#![no_std]
|
||||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
#[cfg(any(feature = "std", test))]
|
||||
extern crate std;
|
||||
|
||||
pub use satrs_mib_codegen::*;
|
||||
pub mod res_code;
|
||||
|
@ -1,10 +1,10 @@
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
#[cfg(feature = "std")]
|
||||
pub use stdmod::*;
|
||||
|
||||
pub use satrs_core::res_code::ResultU16;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_hex::{SerHex, StrictCapPfx};
|
||||
|
||||
#[derive(Debug, Copy, Clone, Serialize)]
|
||||
pub struct ResultU16Info {
|
||||
pub name: &'static str,
|
||||
@ -55,7 +55,13 @@ impl From<ResultU16Info> for ResultU16InfoSerializable {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_resultcodes_as_csv(codes: &[ResultU16Info]) -> Result<(), csv::Error> {
|
||||
#[cfg(feature = "std")]
|
||||
pub mod stdmod {
|
||||
use std::path::Path;
|
||||
use std::io;
|
||||
use super::*;
|
||||
|
||||
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))?;
|
||||
@ -76,16 +82,18 @@ pub fn write_resultcodes_to_csv(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::io::{BufRead, BufReader};
|
||||
// Special solution for this crate because the code generated by a macro will use
|
||||
// satrs_mib::res_code::*
|
||||
use crate as satrs_mib;
|
||||
use satrs_core::res_code::ResultU16;
|
||||
use satrs_macros::resultcode;
|
||||
use satrs_mib::resultcode;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(dead_code)]
|
||||
|
Loading…
Reference in New Issue
Block a user