Module nannou_core::prelude[][src]

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;Deprecated
pub use crate::geom::Vector3;Deprecated
pub use crate::geom::Vector4;Deprecated
pub 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

bounds
cast
float
identities
int
ops
pow
real
rgb

RGB types, spaces and standards.

sign

Structs

Affine2

A 2D affine transform, which can represent translation, rotation, scaling and shear.

Affine3A

A 3D affine transform, which can represent translation, rotation, scaling and shear.

BVec2

A 2-dimensional boolean vector.

BVec3

A 3-dimensional boolean vector.

BVec4

A 4-dimensional boolean vector.

DAffine2

A 2D affine transform, which can represent translation, rotation, scaling and shear.

DAffine3

A 3D affine transform, which can represent translation, rotation, scaling and shear.

DMat2

A 2x2 column major matrix.

DMat3

A 3x3 column major matrix.

DMat4

A 4x4 column major matrix.

DQuat

A quaternion representing an orientation.

DVec2

A 2-dimensional vector.

DVec3

A 3-dimensional vector.

DVec4

A 4-dimensional vector.

Hsl

Linear HSL color space.

Hsv

Linear HSV color space.

IVec2

A 2-dimensional vector.

IVec3

A 3-dimensional vector.

IVec4

A 4-dimensional vector.

Mat2

A 2x2 column major matrix.

Mat3

A 3x3 column major matrix.

Mat3A

A 3x3 column major matrix.

Mat4

A 4x4 column major matrix.

ParseFloatError
Quat

A quaternion representing an orientation.

UVec2

A 2-dimensional vector.

UVec3

A 3-dimensional vector.

UVec4

A 4-dimensional vector.

Vec2

A 2-dimensional vector.

Vec3

A 3-dimensional vector without SIMD support.

Vec3A

A 3-dimensional vector with SIMD support.

Vec4

A 4-dimensional vector.

Enums

FloatErrorKind

Constants

ALICEBLUE
ANTIQUEWHITE
AQUA
AQUAMARINE
AZURE
BEIGE
BISQUE
BLACK
BLANCHEDALMOND
BLUE
BLUEVIOLET
BROWN
BURLYWOOD
CADETBLUE
CHARTREUSE
CHOCOLATE
CORAL
CORNFLOWERBLUE
CORNSILK
CRIMSON
CYAN
DARKBLUE
DARKCYAN
DARKGOLDENROD
DARKGRAY
DARKGREEN
DARKGREY
DARKKHAKI
DARKMAGENTA
DARKOLIVEGREEN
DARKORANGE
DARKORCHID
DARKRED
DARKSALMON
DARKSEAGREEN
DARKSLATEBLUE
DARKSLATEGRAY
DARKSLATEGREY
DARKTURQUOISE
DARKVIOLET
DEEPPINK
DEEPSKYBLUE
DIMGRAY
DIMGREY
DODGERBLUE
FIREBRICK
FLORALWHITE
FORESTGREEN
FUCHSIA
GAINSBORO
GHOSTWHITE
GOLD
GOLDENROD
GRAY
GREEN
GREENYELLOW
GREY
HONEYDEW
HOTPINK
INDIANRED
INDIGO
IVORY
KHAKI
LAVENDER
LAVENDERBLUSH
LAWNGREEN
LEMONCHIFFON
LIGHTBLUE
LIGHTCORAL
LIGHTCYAN
LIGHTGOLDENRODYELLOW
LIGHTGRAY
LIGHTGREEN
LIGHTGREY
LIGHTPINK
LIGHTSALMON
LIGHTSEAGREEN
LIGHTSKYBLUE
LIGHTSLATEGRAY
LIGHTSLATEGREY
LIGHTSTEELBLUE
LIGHTYELLOW
LIME
LIMEGREEN
LINEN
MAGENTA
MAROON
MEDIUMAQUAMARINE
MEDIUMBLUE
MEDIUMORCHID
MEDIUMPURPLE
MEDIUMSEAGREEN
MEDIUMSLATEBLUE
MEDIUMSPRINGGREEN
MEDIUMTURQUOISE
MEDIUMVIOLETRED
MIDNIGHTBLUE
MINTCREAM
MISTYROSE
MOCCASIN
NAVAJOWHITE
NAVY
OLDLACE
OLIVE
OLIVEDRAB
ORANGE
ORANGERED
ORCHID
PALEGOLDENROD
PALEGREEN
PALETURQUOISE
PALEVIOLETRED
PAPAYAWHIP
PEACHPUFF
PERU
PI

Archimedes’ constant (π)

PINK
PI_F64

Archimedes’ constant (π)

PLUM
POWDERBLUE
PURPLE
REBECCAPURPLE
RED
ROSYBROWN
ROYALBLUE
SADDLEBROWN
SALMON
SANDYBROWN
SEAGREEN
SEASHELL
SIENNA
SILVER
SKYBLUE
SLATEBLUE
SLATEGRAY
SLATEGREY
SNOW
SPRINGGREEN
STEELBLUE
TAN
TAU

The full circle constant (τ)

TAU_F64

The full circle constant (τ)

TEAL
THISTLE
TOMATO
TURQUOISE
VIOLET
WHEAT
WHITE
WHITESMOKE
YELLOW
YELLOWGREEN

Traits

AsPrimitive

A generic interface for casting between machine scalars with the as operator, which admits narrowing and precision loss. Implementers of this trait AsPrimitive should behave like a primitive numeric type (e.g. a newtype around another primitive), and the intended conversion must never fail.

Bounded

Numbers which have upper and lower bounds

CheckedAdd

Performs addition that returns None instead of wrapping around on overflow.

CheckedDiv

Performs division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.

CheckedMul

Performs multiplication that returns None instead of wrapping around on underflow or overflow.

CheckedNeg

Performs negation that returns None if the result can’t be represented.

CheckedRem

Performs an integral remainder that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.

CheckedShl

Performs a left shift that returns None on shifts larger than the type width.

CheckedShr

Performs a right shift that returns None on shifts larger than the type width.

CheckedSub

Performs subtraction that returns None instead of wrapping around on underflow.

Float

Generic trait for floating point numbers

FloatConst
FromPrimitive

A generic trait for converting a number to a value.

Inv

Unary operator for retrieving the multiplicative inverse, or reciprocal, of a value.

MulAdd

Fused multiply-add. Computes (self * a) + b with only one rounding error, yielding a more accurate result than an unfused multiply-add.

MulAddAssign

The fused multiply-add assignment operation.

Num

The base trait for numeric types, covering 0 and 1 values, comparisons, basic numeric operations, and string conversion.

NumAssign

The trait for Num types which also implement assignment operators.

NumAssignOps

The trait for types implementing numeric assignment operators (like +=).

NumAssignRef

The trait for NumAssign types which also implement assignment operations taking the second operand by reference.

NumCast

An interface for casting between machine scalars.

NumOps

The trait for types implementing basic numeric operations

NumRef

The trait for Num types which also implement numeric operations taking the second operand by reference.

One

Defines a multiplicative identity element for Self.

Pow

Binary operator for raising a value to a power.

PrimInt

Generic trait for primitive integers.

RefNum

The trait for references which implement numeric operations, taking the second operand either by value or by reference.

Saturating

Saturating math operations. Deprecated, use SaturatingAdd, SaturatingSub and SaturatingMul instead.

SaturatingAdd

Performs addition that saturates at the numeric bounds instead of overflowing.

SaturatingMul

Performs multiplication that saturates at the numeric bounds instead of overflowing.

SaturatingSub

Performs subtraction that saturates at the numeric bounds instead of overflowing.

Signed

Useful functions for signed numbers (i.e. numbers that can be negative).

ToPrimitive

A generic trait for converting a value to a number.

Unsigned

A trait for values which cannot be negative

WrappingAdd

Performs addition that wraps around on overflow.

WrappingMul

Performs multiplication that wraps around on overflow.

WrappingNeg

Performs a negation that does not panic.

WrappingShl

Performs a left shift that does not panic.

WrappingShr

Performs a right shift that does not panic.

WrappingSub

Performs subtraction that wraps around on overflow.

Zero

Defines an additive identity element for Self.

Functions

abs

Computes the absolute value.

abs_sub

The positive difference of two numbers.

cast

Cast from one machine scalar to another.

checked_pow

Raises a value to the power of exp, returning None if an overflow occurred.

clamp

A value bounded by a minimum and a maximum

clamp_max

A value bounded by a maximum value

clamp_min

A value bounded by a minimum value

dmat2

Creates a 2x2 matrix from two column vectors.

dmat3

Creates a 3x3 matrix from three column vectors.

dmat4

Creates a 4x4 matrix from four column vectors.

dquat

Creates a quaternion from x, y, z and w values.

dvec2

Creates a 2-dimensional vector.

dvec3

Creates a 3-dimensional vector.

dvec4

Creates a 4-dimensional vector.

ivec2

Creates a 2-dimensional vector.

ivec3

Creates a 3-dimensional vector.

ivec4

Creates a 4-dimensional vector.

mat2

Creates a 2x2 matrix from two column vectors.

mat3

Creates a 3x3 matrix from three column vectors.

mat3a

Creates a 3x3 matrix from three column vectors.

mat4

Creates a 4x4 matrix from four column vectors.

one

Returns the multiplicative identity, 1.

pow

Raises a value to the power of exp, using exponentiation by squaring.

quat

Creates a quaternion from x, y, z and w values.

random

Generates a random value using the thread-local random number generator.

signum

Returns the sign of the number.

vec2

Creates a 2-dimensional vector.

vec3

Creates a 3-dimensional vector.

vec3a

Creates a 3-dimensional vector.

vec4

Creates a 4-dimensional vector.

zero

Returns the additive identity, 0.

Type Definitions

Hsla

Linear HSL with an alpha component. See the Hsla implementation in Alpha.

Hsva

Linear HSV with an alpha component. See the Hsva implementation in Alpha.

LinSrgb

Linear sRGB.

LinSrgba

Linear sRGB with an alpha component.

Srgb

Nonlinear sRGB.

Srgba

Nonlinear sRGB with an alpha component.