Skip to content

Commit 1b453fc

Browse files
committed
Fix docs
1 parent ec7d6f3 commit 1b453fc

4 files changed

Lines changed: 70 additions & 10 deletions

File tree

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build]
2+
# Documentation configuration
3+
# rustdocflags = []

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "zelen"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2024"
55
description = "Selen CSP solver parser for FlatZinc"
66
rust-version = "1.88"
@@ -12,6 +12,11 @@ repository = "https://github.com/radevgit/zelen"
1212
documentation = "https://docs.rs/zelen"
1313
readme = "README.md"
1414

15+
[package.metadata.docs.rs]
16+
# docs.rs configuration
17+
default-target = "x86_64-unknown-linux-gnu"
18+
targets = []
19+
1520

1621
[lib]
1722
crate-type = ["lib"]

src/lib.rs

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,88 @@
22
//!
33
//! Zelen provides FlatZinc parsing and integration with the Selen constraint solver.
44
//!
5-
//! ## Example
5+
//! ## Quick Start
66
//!
7-
//! ```rust,ignore
7+
//! ```rust
88
//! use zelen::prelude::*;
99
//!
10-
//! let mut model = Model::default();
11-
//! model.from_flatzinc_file("problem.fzn")?;
12-
//! let solution = model.solve()?;
10+
//! // Define a simple FlatZinc problem
11+
//! let fzn = r#"
12+
//! var 1..10: x;
13+
//! var 1..10: y;
14+
//! constraint int_eq(x, 5);
15+
//! constraint int_plus(x, y, 12);
16+
//! solve satisfy;
17+
//! "#;
18+
//!
19+
//! // Create solver and solve
20+
//! let mut solver = FlatZincSolver::new();
21+
//! solver.load_str(fzn).unwrap();
22+
//!
23+
//! if solver.solve().is_ok() {
24+
//! // Get FlatZinc-formatted output
25+
//! let output = solver.to_flatzinc();
26+
//! assert!(output.contains("x = 5"));
27+
//! assert!(output.contains("y = 7"));
28+
//! }
1329
//! ```
30+
//!
31+
//! ## Main API
32+
//!
33+
//! The primary way to use Zelen is through the [`FlatZincSolver`] which provides
34+
//! automatic FlatZinc parsing and spec-compliant output formatting.
35+
//!
36+
//! For more control, you can use the lower-level [`FlatZincModel`] trait or work
37+
//! with individual modules directly.
38+
//!
39+
//! See the [`prelude`] module for commonly used types and traits.
1440
41+
// Internal implementation modules - hidden from docs by default
42+
#[doc(hidden)]
1543
pub mod ast;
1644
pub mod error;
45+
#[doc(hidden)]
1746
pub mod tokenizer;
47+
#[doc(hidden)]
1848
pub mod parser;
49+
#[doc(hidden)]
1950
pub mod mapper;
51+
52+
// Public API modules
2053
pub mod output;
2154
pub mod solver;
2255
pub mod integration;
2356

2457
pub use error::{FlatZincError, FlatZincResult};
58+
pub use solver::{FlatZincSolver, FlatZincContext, SolverOptions};
59+
pub use integration::FlatZincModel;
2560

26-
// Re-export selen for convenience
61+
// Re-export selen for convenience, but hide its docs since users should refer to selen's own docs
62+
#[doc(no_inline)]
2763
pub use selen;
2864

29-
/// Prelude module for common imports
65+
/// Prelude module for convenient imports.
66+
///
67+
/// This module re-exports the most commonly used types and traits.
68+
///
69+
/// # Example
70+
///
71+
/// ```rust
72+
/// use zelen::prelude::*;
73+
///
74+
/// let mut solver = FlatZincSolver::new();
75+
/// // ... use solver
76+
/// ```
3077
pub mod prelude {
78+
//! Commonly used types and traits for working with FlatZinc.
79+
3180
pub use crate::error::{FlatZincError, FlatZincResult};
32-
pub use crate::integration::*;
81+
pub use crate::integration::FlatZincModel;
3382
pub use crate::output::{OutputFormatter, SearchType, SolveStatistics};
3483
pub use crate::solver::{FlatZincContext, FlatZincSolver, SolverOptions};
84+
85+
// Re-export Selen's prelude, but don't inline the docs
86+
#[doc(no_inline)]
3587
pub use selen::prelude::*;
3688
}
3789

0 commit comments

Comments
 (0)