mod claims;
pub mod layout;
pub mod lint;
pub mod manifest;
mod parse;
pub mod report;
mod schema;
#[cfg(feature = "native")]
mod fix;
#[cfg(feature = "native")]
mod evidence;
#[cfg(feature = "native")]
mod paper;
#[cfg(feature = "native")]
mod sections;
pub use layout::{LayoutOptions, LayoutResult, NodePosition, Point, Rect};
pub use manifest::{
Binding, BindingRole, BuiltOn, Claim, ClaimId, Concept, Exhibit, ExhibitKind, Link, LinkKind,
Manifest, Node, NodeExhibit, NodeFields, NodeId, NodeKind, PaperMeta, Problem, Recipe,
RelatedWork,
};
pub use report::{Diagnostic, ParseReport, Severity};
pub use lint::{FixCandidate, LintDiagnostic, LintFile, LintReport, LintRuleId};
#[cfg(feature = "native")]
pub use lint::{check_dir, check_sources};
#[cfg(feature = "native")]
pub use fix::{AppliedFix, FixOutcome, SkippedFix, fix_dir};
#[cfg(feature = "native")]
pub use parse::parse_dir;
pub use parse::parse_sources;
pub fn parse_and_layout(
tree_yaml: &str,
claims_md: Option<&str>,
opts: &LayoutOptions,
) -> Result<(Manifest, ParseReport), ParseReport> {
let (mut manifest, report) = parse_sources(tree_yaml, claims_md)?;
let result = layout::layout(&manifest, opts);
for np in result.positions {
if let Some(node) = manifest.nodes.iter_mut().find(|n| n.id == np.id) {
node.pos = Some(np.pos);
}
}
manifest.bounds = Some(result.bounds);
Ok((manifest, report))
}
#[cfg(feature = "native")]
pub fn parse_and_layout_dir(
dir: &std::path::Path,
opts: &LayoutOptions,
) -> Result<(Manifest, ParseReport), ParseReport> {
let (mut manifest, report) = parse_dir(dir)?;
let result = layout::layout(&manifest, opts);
for np in result.positions {
if let Some(node) = manifest.nodes.iter_mut().find(|n| n.id == np.id) {
node.pos = Some(np.pos);
}
}
manifest.bounds = Some(result.bounds);
Ok((manifest, report))
}
pub fn version() -> &'static str {
env!("CARGO_PKG_VERSION")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn version_is_reported() {
assert_eq!(version(), env!("CARGO_PKG_VERSION"));
}
}