shrupl/src/lib.rs

38 lines
845 B
Rust
Raw Normal View History

2025-06-25 16:34:32 +00:00
// TODO fix with documentation
#![allow(clippy::missing_errors_doc)]
2025-06-25 16:34:22 +00:00
mod appstate;
mod cachefile;
mod cli;
2025-06-27 01:55:43 +00:00
mod error;
2025-06-25 16:34:22 +00:00
mod file;
mod impl_ureq;
pub mod output;
mod sharry;
pub use appstate::AppState;
pub use cli::Cli;
2025-06-27 01:55:43 +00:00
pub use error::{Error, Parameter, Result};
2025-07-03 10:32:46 +00:00
#[cfg(test)]
pub fn check_trait<E, A>(expected: &E, actual: &A, tr: &'static str, ty: &'static str)
where
E: std::fmt::Debug + PartialEq<A>,
A: std::fmt::Debug,
{
assert_eq!(
expected, actual,
"`impl {tr} for {ty}` expected: {expected:?}, actual: {actual:?}",
);
}
/// Helper to create a temp file from `data`
#[cfg(test)]
fn create_file(data: &[u8]) -> tempfile::NamedTempFile {
use std::io::Write;
let mut tmp = tempfile::NamedTempFile::new().expect("creating temp file");
tmp.write_all(data).expect("writing to tempfile");
tmp
}