#[repr(C)]pub struct AngleValue {
pub metric: AngleMetric,
pub number: FloatValue,
}Expand description
FloatValue, but associated with a certain metric (i.e. deg, rad, etc.)
Fields§
§metric: AngleMetric§number: FloatValueImplementations§
Source§impl AngleValue
impl AngleValue
Sourcepub const fn const_deg(value: isize) -> Self
pub const fn const_deg(value: isize) -> Self
Creates a const angle value in degrees from an integer.
Sourcepub const fn const_rad(value: isize) -> Self
pub const fn const_rad(value: isize) -> Self
Creates a const angle value in radians from an integer.
Sourcepub const fn const_grad(value: isize) -> Self
pub const fn const_grad(value: isize) -> Self
Creates a const angle value in gradians from an integer.
Sourcepub const fn const_turn(value: isize) -> Self
pub const fn const_turn(value: isize) -> Self
Creates a const angle value in turns from an integer.
Sourcepub const fn const_percent(value: isize) -> Self
pub const fn const_percent(value: isize) -> Self
Creates a const angle value in percent from an integer.
Sourcepub const fn const_from_metric(metric: AngleMetric, value: isize) -> Self
pub const fn const_from_metric(metric: AngleMetric, value: isize) -> Self
Creates a const angle value with the given metric from an integer.
Sourcepub const fn const_from_metric_fractional(
metric: AngleMetric,
pre_comma: isize,
post_comma: isize,
) -> Self
pub const fn const_from_metric_fractional( metric: AngleMetric, pre_comma: isize, post_comma: isize, ) -> Self
Creates a const angle value with the given metric from a fractional number.
§Arguments
metric- The angle metric (Degree, Radians, etc.)pre_comma- The integer part (e.g., 45 for 45.5deg)post_comma- The fractional part as digits (e.g., 5 for 0.5deg)
Sourcepub fn from_metric(metric: AngleMetric, value: f32) -> Self
pub fn from_metric(metric: AngleMetric, value: f32) -> Self
Creates an angle value with the given metric.
Sourcepub fn to_degrees(&self) -> f32
pub fn to_degrees(&self) -> f32
Convert to degrees, normalized to [0, 360) range.
Note: 360.0 becomes 0.0 due to modulo operation.
For conic gradients where 360.0 is meaningful, use to_degrees_raw().
Sourcepub fn to_degrees_raw(&self) -> f32
pub fn to_degrees_raw(&self) -> f32
Convert to degrees without normalization (raw value). Use this for conic gradients where 360.0 is a meaningful distinct value from 0.0.
Trait Implementations§
Source§impl Clone for AngleValue
impl Clone for AngleValue
Source§fn clone(&self) -> AngleValue
fn clone(&self) -> AngleValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AngleValue
impl Debug for AngleValue
Source§impl Default for AngleValue
impl Default for AngleValue
Source§fn default() -> AngleValue
fn default() -> AngleValue
Source§impl Display for AngleValue
impl Display for AngleValue
Source§impl Hash for AngleValue
impl Hash for AngleValue
Source§impl Ord for AngleValue
impl Ord for AngleValue
Source§fn cmp(&self, other: &AngleValue) -> Ordering
fn cmp(&self, other: &AngleValue) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for AngleValue
impl PartialEq for AngleValue
Source§fn eq(&self, other: &AngleValue) -> bool
fn eq(&self, other: &AngleValue) -> bool
self and other values to be equal, and is used by ==.