Skip to content

Commit

Permalink
Merge pull request #9 from cookiephone/api-consistency
Browse files Browse the repository at this point in the history
API consistency: remove trait bounds for generics of adapters
  • Loading branch information
cookiephone authored Nov 27, 2023
2 parents b700f79 + c17ad03 commit 8c0184f
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 91 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libnoise"
version = "1.0.0"
version = "1.1.0"
authors = ["Contributors to the libnoise-rs Repository"]
edition = "2021"
license = "MIT"
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/abs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`abs()`]: Generator::abs
#[derive(Clone, Copy, Debug)]
pub struct Abs<const D: usize, G>
where
G: Generator<D>,
{
pub struct Abs<const D: usize, G> {
generator: G,
}

Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`add()`]: Generator::add
#[derive(Clone, Copy, Debug)]
pub struct Add<const D: usize, G>
where
G: Generator<D>,
{
pub struct Add<const D: usize, G> {
generator: G,
offset: f64,
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/billow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`billow()`]: Generator::billow
#[derive(Clone, Copy, Debug)]
pub struct Billow<const D: usize, G>
where
G: Generator<D>,
{
pub struct Billow<const D: usize, G> {
generator: G,
octaves: u32,
frequency: f64,
Expand Down
7 changes: 1 addition & 6 deletions src/core/adapters/blend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`blend()`]: Generator::blend
#[derive(Clone, Copy, Debug)]
pub struct Blend<const D: usize, GA, GB, GC>
where
GA: Generator<D>,
GB: Generator<D>,
GC: Generator<D>,
{
pub struct Blend<const D: usize, GA, GB, GC> {
generator_a: GA,
generator_b: GB,
generator_control: GC,
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/clamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`clamp()`]: Generator::clamp
#[derive(Clone, Copy, Debug)]
pub struct Clamp<const D: usize, G>
where
G: Generator<D>,
{
pub struct Clamp<const D: usize, G> {
generator: G,
min: f64,
max: f64,
Expand Down
6 changes: 1 addition & 5 deletions src/core/adapters/displace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`displace_x()`]: Generator2D::displace_x
#[derive(Clone, Copy, Debug)]
pub struct Displace<const D: usize, const A: usize, G, GA>
where
G: Generator<D>,
GA: Generator<D>,
{
pub struct Displace<const D: usize, const A: usize, G, GA> {
generator: G,
displacement_generator: GA,
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/exp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`exp()`]: Generator::exp
#[derive(Clone, Copy, Debug)]
pub struct Exp<const D: usize, G>
where
G: Generator<D>,
{
pub struct Exp<const D: usize, G> {
generator: G,
}

Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/fbm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`fbm()`]: Generator::fbm
#[derive(Clone, Copy, Debug)]
pub struct Fbm<const D: usize, G>
where
G: Generator<D>,
{
pub struct Fbm<const D: usize, G> {
generator: G,
octaves: u32,
frequency: f64,
Expand Down
6 changes: 1 addition & 5 deletions src/core/adapters/lambda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`lambda()`]: Generator::lambda
#[derive(Clone, Copy, Debug)]
pub struct Lambda<const D: usize, G, L>
where
G: Generator<D>,
L: Fn(f64) -> f64,
{
pub struct Lambda<const D: usize, G, L> {
generator: G,
lambda: L,
}
Expand Down
6 changes: 1 addition & 5 deletions src/core/adapters/max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`max()`]: Generator::max
#[derive(Clone, Copy, Debug)]
pub struct Max<const D: usize, GA, GB>
where
GA: Generator<D>,
GB: Generator<D>,
{
pub struct Max<const D: usize, GA, GB> {
generator_a: GA,
generator_b: GB,
}
Expand Down
6 changes: 1 addition & 5 deletions src/core/adapters/min.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`min()`]: Generator::min
#[derive(Clone, Copy, Debug)]
pub struct Min<const D: usize, GA, GB>
where
GA: Generator<D>,
GB: Generator<D>,
{
pub struct Min<const D: usize, GA, GB> {
generator_a: GA,
generator_b: GB,
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`mul()`]: Generator::mul
#[derive(Clone, Copy, Debug)]
pub struct Mul<const D: usize, G>
where
G: Generator<D>,
{
pub struct Mul<const D: usize, G> {
generator: G,
scale: f64,
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/pow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
/// [`powi()`]: Generator::powi
/// [`powf()`]: Generator::powf
#[derive(Clone, Copy, Debug)]
pub struct Pow<const D: usize, G, T>
where
G: Generator<D>,
{
pub struct Pow<const D: usize, G, T> {
generator: G,
exponent: T,
}
Expand Down
6 changes: 1 addition & 5 deletions src/core/adapters/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`power()`]: Generator::power
#[derive(Clone, Copy, Debug)]
pub struct Power<const D: usize, GA, GB>
where
GA: Generator<D>,
GB: Generator<D>,
{
pub struct Power<const D: usize, GA, GB> {
generator_a: GA,
generator_b: GB,
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/ridgedmulti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
/// [`fbm()`]: Generator:fbm
/// [`ridgedmulti()`]: Generator::ridgedmulti
#[derive(Clone, Copy, Debug)]
pub struct RidgedMulti<const D: usize, G>
where
G: Generator<D>,
{
pub struct RidgedMulti<const D: usize, G> {
generator: G,
octaves: u32,
frequency: f64,
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/rotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator2D, Generator3D, Generator4D};
///
/// [`rotate()`]: Generator2D::rotate
#[derive(Clone, Copy, Debug)]
pub struct Rotate<const D: usize, const P: usize, G>
where
G: Generator<D>,
{
pub struct Rotate<const D: usize, const P: usize, G> {
generator: G,
rotation: [f64; P],
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`scale()`]: Generator::scale
#[derive(Clone, Copy, Debug)]
pub struct Scale<const D: usize, G>
where
G: Generator<D>,
{
pub struct Scale<const D: usize, G> {
generator: G,
scale: [f64; D],
}
Expand Down
7 changes: 1 addition & 6 deletions src/core/adapters/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`select()`]: Generator::select
#[derive(Clone, Copy, Debug)]
pub struct Select<const D: usize, GA, GB, GC>
where
GA: Generator<D>,
GB: Generator<D>,
GC: Generator<D>,
{
pub struct Select<const D: usize, GA, GB, GC> {
generator_a: GA,
generator_b: GB,
generator_control: GC,
Expand Down
6 changes: 1 addition & 5 deletions src/core/adapters/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`sum()`]: Generator::sum
#[derive(Clone, Copy, Debug)]
pub struct Sum<const D: usize, GA, GB>
where
GA: Generator<D>,
GB: Generator<D>,
{
pub struct Sum<const D: usize, GA, GB> {
generator_a: GA,
generator_b: GB,
}
Expand Down
5 changes: 1 addition & 4 deletions src/core/adapters/translate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::core::generator::{Generator, Generator1D, Generator2D, Generator3D, G
///
/// [`translate()`]: Generator::translate
#[derive(Clone, Copy, Debug)]
pub struct Translate<const D: usize, G>
where
G: Generator<D>,
{
pub struct Translate<const D: usize, G> {
generator: G,
translation: [f64; D],
}
Expand Down

0 comments on commit 8c0184f

Please sign in to comment.