Module nannou_core::prelude
source · Expand description
A collection of commonly used items that are generally useful to have in scope.
Re-exports
pub use crate::color::gray;
pub use crate::color::hsl;
pub use crate::color::hsla;
pub use crate::color::hsv;
pub use crate::color::hsva;
pub use crate::color::lin_srgb;
pub use crate::color::lin_srgba;
pub use crate::color::rgb;
pub use crate::color::rgb8;
pub use crate::color::rgba;
pub use crate::color::rgba8;
pub use crate::color::srgb;
pub use crate::color::srgb8;
pub use crate::color::srgba;
pub use crate::color::srgba8;
pub use crate::color::Gray;
pub use crate::color::Rgb;
pub use crate::color::Rgb8;
pub use crate::color::Rgba;
pub use crate::color::Rgba8;
pub use crate::geom;
pub use crate::geom::pt2;
pub use crate::geom::pt3;
pub use crate::geom::Cuboid;
pub use crate::geom::Point2;
pub use crate::geom::Point3;
pub use crate::geom::Rect;
pub use crate::geom::Vector2;
Deprecatedpub use crate::geom::Vector3;
Deprecatedpub use crate::geom::Vector4;
Deprecatedpub use crate::math::clamp;
pub use crate::math::deg_to_rad;
pub use crate::math::fmod;
pub use crate::math::map_range;
pub use crate::math::partial_max;
pub use crate::math::partial_min;
pub use crate::math::rad_to_deg;
pub use crate::math::rad_to_turns;
pub use crate::math::turns_to_rad;
pub use crate::math::Mat4LookTo;
pub use crate::math::Vec2Angle;
pub use crate::math::Vec2Rotate;
pub use crate::rand::random_ascii;
pub use crate::rand::random_f32;
pub use crate::rand::random_f64;
pub use crate::rand::random_range;
Modules
- RGB types, spaces and standards.
Structs
- A 2D affine transform, which can represent translation, rotation, scaling and shear.
- A 3D affine transform, which can represent translation, rotation, scaling and shear.
- A 2-dimensional boolean vector.
- A 3-dimensional boolean vector.
- A 4-dimensional boolean vector.
- A 2D affine transform, which can represent translation, rotation, scaling and shear.
- A 3D affine transform, which can represent translation, rotation, scaling and shear.
- A 2x2 column major matrix.
- A 3x3 column major matrix.
- A 4x4 column major matrix.
- A quaternion representing an orientation.
- A 2-dimensional vector.
- A 3-dimensional vector.
- A 4-dimensional vector.
- Linear HSL color space.
- Linear HSV color space.
- A 2-dimensional vector.
- A 3-dimensional vector.
- A 4-dimensional vector.
- A 2x2 column major matrix.
- A 3x3 column major matrix.
- A 3x3 column major matrix.
- A 4x4 column major matrix.
- A quaternion representing an orientation.
- A 2-dimensional vector.
- A 3-dimensional vector.
- A 4-dimensional vector.
- A 2-dimensional vector.
- A 3-dimensional vector without SIMD support.
- A 3-dimensional vector with SIMD support.
- A 4-dimensional vector.
Enums
Constants
- Archimedes’ constant (π)
- Archimedes’ constant (π)
- The full circle constant (τ)
- The full circle constant (τ)
Traits
- A generic interface for casting between machine scalars with the
as
operator, which admits narrowing and precision loss. Implementers of this traitAsPrimitive
should behave like a primitive numeric type (e.g. a newtype around another primitive), and the intended conversion must never fail. - Numbers which have upper and lower bounds
- Performs addition that returns
None
instead of wrapping around on overflow. - Performs division that returns
None
instead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Performs multiplication that returns
None
instead of wrapping around on underflow or overflow. - Performs negation that returns
None
if the result can’t be represented. - Performs an integral remainder that returns
None
instead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Performs a left shift that returns
None
on shifts larger than or equal to the type width. - Performs a right shift that returns
None
on shifts larger than or equal to the type width. - Performs subtraction that returns
None
instead of wrapping around on underflow. - Generic trait for floating point numbers
- A generic trait for converting a number to a value.
- Unary operator for retrieving the multiplicative inverse, or reciprocal, of a value.
- Fused multiply-add. Computes
(self * a) + b
with only one rounding error, yielding a more accurate result than an unfused multiply-add. - The fused multiply-add assignment operation
*self = (*self * a) + b
- The base trait for numeric types, covering
0
and1
values, comparisons, basic numeric operations, and string conversion. - The trait for
Num
types which also implement assignment operators. - Generic trait for types implementing numeric assignment operators (like
+=
). - The trait for
NumAssign
types which also implement assignment operations taking the second operand by reference. - An interface for casting between machine scalars.
- Generic trait for types implementing basic numeric operations
- The trait for
Num
types which also implement numeric operations taking the second operand by reference. - Defines a multiplicative identity element for
Self
. - Binary operator for raising a value to a power.
- Generic trait for primitive integers.
- The trait for
Num
references which implement numeric operations, taking the second operand either by value or by reference. - Saturating math operations. Deprecated, use
SaturatingAdd
,SaturatingSub
andSaturatingMul
instead. - Performs addition that saturates at the numeric bounds instead of overflowing.
- Performs multiplication that saturates at the numeric bounds instead of overflowing.
- Performs subtraction that saturates at the numeric bounds instead of overflowing.
- Useful functions for signed numbers (i.e. numbers that can be negative).
- A generic trait for converting a value to a number.
- A trait for values which cannot be negative
- Performs addition that wraps around on overflow.
- Performs multiplication that wraps around on overflow.
- Performs a negation that does not panic.
- Performs a left shift that does not panic.
- Performs a right shift that does not panic.
- Performs subtraction that wraps around on overflow.
- Defines an additive identity element for
Self
.
Functions
- Computes the absolute value.
- The positive difference of two numbers.
- Cast from one machine scalar to another.
- Raises a value to the power of exp, returning
None
if an overflow occurred. - A value bounded by a maximum value
- A value bounded by a minimum value
- Creates a 2x2 matrix from two column vectors.
- Creates a 3x3 matrix from three column vectors.
- Creates a 4x4 matrix from four column vectors.
- Creates a quaternion from
x
,y
,z
andw
values. - Creates a 2-dimensional vector.
- Creates a 3-dimensional vector.
- Creates a 4-dimensional vector.
- Creates a 2-dimensional vector.
- Creates a 3-dimensional vector.
- Creates a 4-dimensional vector.
- Creates a 2x2 matrix from two column vectors.
- Creates a 3x3 matrix from three column vectors.
- Creates a 3x3 matrix from three column vectors.
- Creates a 4x4 matrix from four column vectors.
- Returns the multiplicative identity,
1
. - Raises a value to the power of exp, using exponentiation by squaring.
- Creates a quaternion from
x
,y
,z
andw
values. - Generates a random value using the thread-local random number generator.
- Returns the sign of the number.
- Creates a 2-dimensional vector.
- Creates a 3-dimensional vector.
- Creates a 3-dimensional vector.
- Creates a 4-dimensional vector.
- Returns the additive identity,
0
.
Type Aliases
- Linear HSL with an alpha component. See the
Hsla
implementation inAlpha
. - Linear HSV with an alpha component. See the
Hsva
implementation inAlpha
. - Linear sRGB.
- Linear sRGB with an alpha component.
- Nonlinear sRGB.
- Nonlinear sRGB with an alpha component.