Skip to content

Commit 0a02d62

Browse files
committed
Fix doc
1 parent 1b453fc commit 0a02d62

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

src/integration.rs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@ pub trait FlatZincModel {
2424
///
2525
/// # Example
2626
///
27-
/// ```ignore
27+
/// ```no_run
2828
/// use zelen::prelude::*;
2929
///
30-
/// // Configure model first
31-
/// let mut model = Model::default()
32-
/// .with_timeout_seconds(30);
33-
///
34-
/// model.from_flatzinc_file("problem.fzn")?;
35-
/// let solution = model.solve()?;
30+
/// let mut model = Model::default();
31+
/// model.from_flatzinc_file("problem.fzn").unwrap();
32+
/// let solution = model.solve().unwrap();
3633
/// ```
3734
fn from_flatzinc_file<P: AsRef<Path>>(&mut self, path: P) -> FlatZincResult<()>;
3835

@@ -51,7 +48,7 @@ pub trait FlatZincModel {
5148
///
5249
/// # Example
5350
///
54-
/// ```ignore
51+
/// ```rust
5552
/// use zelen::prelude::*;
5653
///
5754
/// let fzn = r#"
@@ -62,8 +59,8 @@ pub trait FlatZincModel {
6259
/// "#;
6360
///
6461
/// let mut model = Model::default();
65-
/// model.from_flatzinc_str(fzn)?;
66-
/// let solution = model.solve()?;
62+
/// model.from_flatzinc_str(fzn).unwrap();
63+
/// let solution = model.solve().unwrap();
6764
/// ```
6865
fn from_flatzinc_str(&mut self, content: &str) -> FlatZincResult<()>;
6966

@@ -75,7 +72,7 @@ pub trait FlatZincModel {
7572
///
7673
/// # Example
7774
///
78-
/// ```ignore
75+
/// ```rust
7976
/// use zelen::prelude::*;
8077
///
8178
/// let fzn = r#"
@@ -85,11 +82,19 @@ pub trait FlatZincModel {
8582
/// "#;
8683
///
8784
/// let mut model = Model::default();
88-
/// let context = model.load_flatzinc_str(fzn)?;
85+
/// let context = model.load_flatzinc_str(fzn).unwrap();
86+
///
87+
/// // Context contains variable name mappings
88+
/// assert!(context.var_names.values().any(|name| name == "x"));
8989
///
9090
/// match model.solve() {
91-
/// Ok(solution) => context.print_solution(&solution),
92-
/// Err(_) => context.print_unsatisfiable(),
91+
/// Ok(_solution) => {
92+
/// // Solution found! In a real application, you would
93+
/// // use OutputFormatter to format the solution.
94+
/// }
95+
/// Err(_) => {
96+
/// // No solution
97+
/// }
9398
/// }
9499
/// ```
95100
fn load_flatzinc_str(&mut self, content: &str) -> FlatZincResult<FlatZincContext>;

0 commit comments

Comments
 (0)