Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 62 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
/// Rusty Wire library entry point.
///
/// Exposes the I/O-free application layer so that front-ends other than the
/// bundled CLI (e.g. a future `iced` GUI or a test harness) can depend on
/// this crate without pulling in CLI-specific logic.
//! # Rusty Wire
//!
//! Wire-antenna length planning for ham radio, exposed as a library so front-ends
//! other than the bundled CLI (e.g. an `iced` GUI, a bot, or a test harness) can
//! reuse the I/O-free application layer.
//!
//! ## Getting started
//!
//! Build an [`AppConfig`], run it, and read the per-band results:
//!
//! ```
//! use rusty_wire::prelude::*;
//!
//! let config = AppConfig::default();
//! let results = run_calculation(config);
//! for calc in &results.calculations {
//! println!("{}: half-wave {:.2} m", calc.band_name, calc.half_wave_m);
//! }
//!
//! // Or render the same document the CLI/TUI print:
//! let doc = results_display_document(&results);
//! assert!(!doc.band_views.is_empty());
//! ```
//!
//! Use [`run_calculation_checked`] instead of [`run_calculation`] to validate the
//! configuration first (returns an [`AppError`] on invalid input).
//!
//! ## Public API and stability
//!
//! The **stable, semver-tracked** surface is re-exported from [`prelude`]. Prefer
//! importing from there.
//!
//! The [`app`], [`bands`], [`calculations`], [`prefs`], and [`sessions`] modules
//! are public for advanced use, but items *not* re-exported from [`prelude`] may
//! change in minor releases. The [`tui`] module and the `run_tui` entry point are
//! provided for embedding the terminal UI but are not part of the stable API. The
//! CLI, export, NEC-export, and fnec-validation modules are private implementation
//! details.
//!
//! Semantic-versioning policy: breaking changes to `prelude` items bump the major
//! version; additive changes bump the minor version.

pub mod app;
pub(crate) mod band_presets;
pub mod bands;
Expand All @@ -15,6 +52,26 @@ pub mod prefs;
pub mod sessions;
pub mod tui;

/// The stable, semver-tracked public API. Import everything with
/// `use rusty_wire::prelude::*;`.
///
/// Anything re-exported here is covered by the crate's semver policy; other
/// public items may change in minor releases.
pub mod prelude {
#[doc(no_inline)]
pub use crate::app::{
results_display_document, run_calculation, run_calculation_checked, AppConfig, AppError,
AppRequest, AppResponse, AppResults, CalcMode, ResultsDisplayDocument,
};
#[doc(no_inline)]
pub use crate::bands::{Band, BandType, ITURegion};
#[doc(no_inline)]
pub use crate::calculations::{
GroundClass, ImpedanceClass, NonResonantRecommendation, NonResonantSearchConfig,
OcfdSplitRecommendation, ResonantCompromise, TransformerRatio, WireCalculation,
};
}

/// Run the command-line interface with the given argument list.
///
/// Returns `true` on success, `false` if any error prevented completion.
Expand Down
Loading