Skip to content

Commit

Permalink
feat!: remove prelude and move important types to lib root
Browse files Browse the repository at this point in the history
  • Loading branch information
pnevyk committed Nov 12, 2023
1 parent 6c9d46a commit 17f8674
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/rosenbrock.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use gomez::nalgebra as na;
use gomez::prelude::*;
use gomez::solver::TrustRegion;
use gomez::{Domain, Problem, Solver, System};
use na::{Dynamic, IsContiguous};

// https://en.wikipedia.org/wiki/Rosenbrock_function
Expand Down
2 changes: 1 addition & 1 deletion gomez-bench/benches/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ fn main() {
use gomez::{
nalgebra as na,
nalgebra::Dynamic,
prelude::*,
solver::{NelderMead, TrustRegion},
testing::*,
Domain, Problem, Solver,
};
use gsl_wrapper::{
function::Function as GslFunction,
Expand Down
3 changes: 1 addition & 2 deletions src/core/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use super::{base::Problem, system::System};
/// ([`apply`](Function::apply)).
///
/// ```rust
/// use gomez::core::Function;
/// use gomez::nalgebra as na;
/// use gomez::prelude::*;
/// use gomez::{Domain, Function, Problem};
/// use na::{Dynamic, IsContiguous};
///
/// // A problem is represented by a type.
Expand Down
2 changes: 1 addition & 1 deletion src/core/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::{domain::Domain, function::Function};
///
/// ```rust
/// use gomez::nalgebra as na;
/// use gomez::core::*;
/// use gomez::*;
/// use na::{storage::StorageMut, Dynamic, IsContiguous, Vector};
/// use rand::Rng;
/// use rand_distr::{uniform::SampleUniform, Distribution, Standard};
Expand Down
2 changes: 1 addition & 1 deletion src/core/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use super::{domain::Domain, system::System};
///
/// ```rust
/// use gomez::nalgebra as na;
/// use gomez::core::*;
/// use gomez::*;
/// use na::{storage::StorageMut, Dynamic, IsContiguous, Vector};
/// use rand::Rng;
/// use rand_distr::{uniform::SampleUniform, Distribution, Standard};
Expand Down
2 changes: 1 addition & 1 deletion src/core/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::{base::Problem, domain::Domain};
///
/// ```rust
/// use gomez::nalgebra as na;
/// use gomez::prelude::*;
/// use gomez::{Domain, Problem, System};
/// use na::{Dynamic, IsContiguous};
///
/// // A problem is represented by a type.
Expand Down
16 changes: 7 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
//! ```rust
//! // Gomez is based on `nalgebra` crate.
//! use gomez::nalgebra as na;
//! use gomez::prelude::*;
//! use gomez::{Domain, Problem, System};
//! use na::{Dynamic, IsContiguous};
//!
//! // A problem is represented by a type.
Expand Down Expand Up @@ -117,7 +117,7 @@
//!
//! ```rust
//! # use gomez::nalgebra as na;
//! # use gomez::prelude::*;
//! # use gomez::*;
//! #
//! # struct Rosenbrock {
//! # a: f64,
Expand Down Expand Up @@ -146,9 +146,10 @@
//!
//! ```rust
//! use gomez::nalgebra as na;
//! use gomez::prelude::*;
//! use gomez::Solver;
//! // Pick your solver.
//! use gomez::solver::TrustRegion;
//! # use gomez::{Domain, Problem, System};
//! # use na::{Dynamic, IsContiguous};
//! #
//! # struct Rosenbrock {
Expand Down Expand Up @@ -234,19 +235,16 @@
//! Licensed under MIT.

pub mod analysis;
pub mod core;
mod core;
pub mod derivatives;
pub mod solver;

pub use core::*;

#[cfg(feature = "testing")]
pub mod testing;

#[cfg(not(feature = "testing"))]
pub(crate) mod testing;

pub use nalgebra;

/// Gomez prelude.
pub mod prelude {
pub use crate::core::{Domain, Problem, Solver, System};
}

0 comments on commit 17f8674

Please sign in to comment.