1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
//! The library provides the basic building blocks for creating games and regular applications.
//! It contains behavior definitions for game applications and basic structures.
//!
//! The basic fundamental entity for graphical applications such as games is color.
//! This library contains sufficient functionality for working with color, including storage,
//! processing and conversion between different color spaces.
//!
//! It also provides support for multiple color schemes and contains the
//! OpenColor palette for the convenience and higher quality of your applications.
#![doc(html_logo_url = "https://dudochkin-victor.github.io/assets/ux-primitives/logo.svg")]
#![warn(missing_docs)]
pub mod foundation;
pub mod prelude;
// /// A one-dimensional distance, with value represented by `T` and unit of measurement `Unit`.
// ///
// /// `T` can be any numeric type, for example a primitive type like `u64` or `f32`.
// ///
// /// `Unit` is not used in the representation of a `Length` value. It is used only at compile time
// /// to ensure that a `Length` stored with one unit is converted explicitly before being used in an
// /// expression that requires a different unit. It may be a type without values, such as an empty
// /// enum.
// ///
// /// You can multiply a `Length` by a `scale::Scale` to convert it from one unit to
// /// another. See the [`Scale`] docs for an example.
// ///
// /// [`Scale`]: struct.Scale.html
// #[repr(C)]
// pub struct Length<T, Unit>(pub T, #[doc(hidden)] pub PhantomData<Unit>);
// /// A 2d size tagged with a unit.
// #[repr(C)]
// pub struct Size2D<T, U> {
// /// The extent of the element in the `U` units along the `x` axis (usually horizontal).
// pub width: T,
// /// The extent of the element in the `U` units along the `y` axis (usually vertical).
// pub height: T,
// #[doc(hidden)]
// pub _unit: PhantomData<U>,
// }
// /// A 3d size tagged with a unit.
// #[repr(C)]
// pub struct Size3D<T, U> {
// /// The extent of the element in the `U` units along the `x` axis.
// pub width: T,
// /// The extent of the element in the `U` units along the `y` axis.
// pub height: T,
// /// The extent #![warn(missing_docs)]of the element in the `U` units along the `z` axis.
// pub depth: T,
// #[doc(hidden)]
// pub _unit: PhantomData<U>,
// }
// /// A 2d Rectangle optionally tagged with a unit.
// ///
// /// # Representation
// ///
// /// `Rect` is represented by an origin point and a size.
// ///
// /// See [`Box2D`] for a rectangle represented by two endpoints.
// ///
// /// # Empty rectangle
// ///
// /// A rectangle is considered empty (see [`is_empty`]) if any of the following is true:
// /// - it's area is empty,
// /// - it's area is negative (`size.x < 0` or `size.y < 0`),
// /// - it contains NaNs.
// ///
// /// [`is_empty`]: #method.is_empty
// /// [`Box2D`]: struct.Box2D.html
// #[repr(C)]
// #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
// #[cfg_attr(
// feature = "serde",
// serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'de>"))
// )]
// pub struct Rect<T, U> {
// pub origin: Point2D<T, U>,
// pub size: Size2D<T, U>,
// }
// /// A 2d axis aligned rectangle represented by its minimum and maximum coordinates.
// ///
// /// # Representation
// ///
// /// This struct is similar to [`Rect`], but stores rectangle as two endpoints
// /// instead of origin point and size. Such representation has several advantages over
// /// [`Rect`] representation:
// /// - Several operations are more efficient with `Box2D`, including [`intersection`],
// /// [`union`], and point-in-rect.
// /// - The representation is less susceptible to overflow. With [`Rect`], computation
// /// of second point can overflow for a large range of values of origin and size.
// /// However, with `Box2D`, computation of [`size`] cannot overflow if the coordinates
// /// are signed and the resulting size is unsigned.
// ///
// /// A known disadvantage of `Box2D` is that translating the rectangle requires translating
// /// both points, whereas translating [`Rect`] only requires translating one point.
// ///
// /// # Empty box
// ///
// /// A box is considered empty (see [`is_empty`]) if any of the following is true:
// /// - it's area is empty,
// /// - it's area is negative (`min.x > max.x` or `min.y > max.y`),
// /// - it contains NaNs.
// ///
// /// [`Rect`]: struct.Rect.html
// /// [`intersection`]: #method.intersection
// /// [`is_empty`]: #method.is_empty
// /// [`union`]: #method.union
// /// [`size`]: #method.size
// #[repr(C)]
// #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
// #[cfg_attr(
// feature = "serde",
// serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'de>"))
// )]
// pub struct Box2D<T, U> {
// pub min: Point2D<T, U>,
// pub max: Point2D<T, U>,
// }
// /// An axis aligned 3D box represented by its minimum and maximum coordinates.
// #[repr(C)]
// #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
// #[cfg_attr(
// feature = "serde",
// serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'de>"))
// )]
// pub struct Box3D<T, U> {
// pub min: Point3D<T, U>,
// pub max: Point3D<T, U>,
// }
// /// A group of 2D side offsets, which correspond to top/right/bottom/left for borders, padding,
// /// and margins in CSS, optionally tagged with a unit.
// #[repr(C)]
// #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
// #[cfg_attr(
// feature = "serde",
// serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'de>"))
// )]
// pub struct SideOffsets2D<T, U> {
// pub top: T,
// pub right: T,
// pub bottom: T,
// pub left: T,
// #[doc(hidden)]
// pub _unit: PhantomData<U>,
// }