pub struct AngleOf<T>(/* private fields */);Expand description
2D Angle, support degree, radian, turn…
Provides conversion to other angle units
Implementations§
Source§impl<T> AngleOf<T>
impl<T> AngleOf<T>
Sourcepub unsafe fn inner_value(self) -> T
pub unsafe fn inner_value(self) -> T
Return the inner value. Unsafe because it expose the inner value, but the unit is not specified and may change
Sourcepub const unsafe fn from_inner_value(inner_value: T) -> AngleOf<T>
pub const unsafe fn from_inner_value(inner_value: T) -> AngleOf<T>
Create from the inner value. Unsafe because it expose the inner value, but the unit is not specified and may change
Source§impl<T> AngleOf<T>where
T: Float,
impl<T> AngleOf<T>where
T: Float,
pub fn from_radian(rad: T) -> AngleOf<T>
pub fn from_degree(degree: T) -> AngleOf<T>
pub fn from_turn(coef: T) -> AngleOf<T>
pub fn radian(self) -> T
pub fn degree(self) -> T
pub fn turn(self) -> T
Sourcepub fn normalized_positive(self) -> AngleOf<T>
pub fn normalized_positive(self) -> AngleOf<T>
[0, 2PI[
Sourcepub fn normalized(self) -> AngleOf<T>
pub fn normalized(self) -> AngleOf<T>
]PI; PI]
Sourcepub fn to_vec2_normalized(self) -> Vector<f32, 2>
pub fn to_vec2_normalized(self) -> Vector<f32, 2>
Return a normalized (length = 1) vector with the same angle
pub fn to_vec2(self, length: T) -> Vector<f32, 2>
Sourcepub fn to_vector2_normalized(self) -> Vector<T, 2>
pub fn to_vector2_normalized(self) -> Vector<T, 2>
Return a normalized (length = 1) vector with the same angle
pub fn to_vector2(self, length: T) -> Vector<T, 2>
pub fn inside_range(self, begin: AngleOf<T>, end: AngleOf<T>) -> bool
Trait Implementations§
Source§impl<T> AddAssign for AngleOf<T>where
T: AddAssign,
impl<T> AddAssign for AngleOf<T>where
T: AddAssign,
Source§fn add_assign(&mut self, rhs: AngleOf<T>)
fn add_assign(&mut self, rhs: AngleOf<T>)
Performs the
+= operation. Read moreSource§impl<'de, T> Deserialize<'de> for AngleOf<T>where
T: Float + Deserialize<'de>,
Available on crate feature serde only.
impl<'de, T> Deserialize<'de> for AngleOf<T>where
T: Float + Deserialize<'de>,
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<AngleOf<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<AngleOf<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> DivAssign<T> for AngleOf<T>where
T: DivAssign,
impl<T> DivAssign<T> for AngleOf<T>where
T: DivAssign,
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreSource§impl<T> MinusInfinity for AngleOf<T>where
T: MinusInfinity,
impl<T> MinusInfinity for AngleOf<T>where
T: MinusInfinity,
const MINUS_INFINITY: AngleOf<T>
fn is_minus_infinity(&self) -> boolwhere
Self: PartialEq,
fn is_not_minus_infinity(&self) -> boolwhere
Self: PartialEq,
Source§impl<T> MulAssign<T> for AngleOf<T>where
T: MulAssign,
impl<T> MulAssign<T> for AngleOf<T>where
T: MulAssign,
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moreSource§impl<T> Ord for AngleOf<T>where
T: Ord,
impl<T> Ord for AngleOf<T>where
T: Ord,
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialOrd for AngleOf<T>where
T: PartialOrd,
impl<T> PartialOrd for AngleOf<T>where
T: PartialOrd,
Source§impl<T> RangeDefault for AngleOf<T>where
T: Float,
impl<T> RangeDefault for AngleOf<T>where
T: Float,
Source§impl<T> RemAssign for AngleOf<T>where
T: RemAssign,
impl<T> RemAssign for AngleOf<T>where
T: RemAssign,
Source§fn rem_assign(&mut self, rhs: AngleOf<T>)
fn rem_assign(&mut self, rhs: AngleOf<T>)
Performs the
%= operation. Read moreSource§impl<T> Serialize for AngleOf<T>
Available on crate feature serde only.
impl<T> Serialize for AngleOf<T>
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl<T> SubAssign for AngleOf<T>where
T: SubAssign,
impl<T> SubAssign for AngleOf<T>where
T: SubAssign,
Source§fn sub_assign(&mut self, rhs: AngleOf<T>)
fn sub_assign(&mut self, rhs: AngleOf<T>)
Performs the
-= operation. Read moreSource§impl<T> WrappedType<T> for AngleOf<T>
impl<T> WrappedType<T> for AngleOf<T>
Source§unsafe fn inner_value(self) -> T
unsafe fn inner_value(self) -> T
Return the inner value.
Unsafe because it expose the inner value, but the unit is not specified and may change
Source§unsafe fn from_inner_value(inner_value: T) -> AngleOf<T>
unsafe fn from_inner_value(inner_value: T) -> AngleOf<T>
Create from the inner value.
Unsafe because it expose the inner value, but the unit is not specified and may change
impl<T> Copy for AngleOf<T>where
T: Copy,
impl<T> Eq for AngleOf<T>where
T: Eq,
impl<T> StructuralPartialEq for AngleOf<T>
Auto Trait Implementations§
impl<T> Freeze for AngleOf<T>where
T: Freeze,
impl<T> RefUnwindSafe for AngleOf<T>where
T: RefUnwindSafe,
impl<T> Send for AngleOf<T>where
T: Send,
impl<T> Sync for AngleOf<T>where
T: Sync,
impl<T> Unpin for AngleOf<T>where
T: Unpin,
impl<T> UnsafeUnpin for AngleOf<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for AngleOf<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<S, T> CastRangeInto<T> for Swhere
T: CastRangeFrom<S>,
impl<S, T> CastRangeInto<T> for Swhere
T: CastRangeFrom<S>,
fn cast_range_into(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DefaultExtension for T
impl<T> DefaultExtension for T
fn is_default(&self) -> bool
fn is_not_default(&self) -> bool
Source§impl<T> DefaultIsTripleUnderscore for Twhere
T: Default,
impl<T> DefaultIsTripleUnderscore for Twhere
T: Default,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromJson for Twhere
T: for<'de> Deserialize<'de>,
fn from_json_bytes(bytes: &[u8]) -> Result<Self, EncodeError>
fn from_json_with_reader<R>(reader: R) -> Result<Self, EncodeError>where
R: Read,
fn from_json(json: &str) -> Result<Self, EncodeError>
Source§impl<T> FromRon for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromRon for Twhere
T: for<'de> Deserialize<'de>,
fn from_ron_bytes(bytes: &[u8]) -> Result<Self, EncodeError>
fn from_ron_with_reader<R>(reader: R) -> Result<Self, EncodeError>where
R: Read,
fn from_ron(ron: &str) -> Result<Self, EncodeError>
Source§impl<T> FromTmpBin for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromTmpBin for Twhere
T: for<'de> Deserialize<'de>,
fn from_tmp_bin_bytes(bytes: &[u8]) -> Result<Self, EncodeError>
fn from_tmp_bin_with_reader<R>(reader: R) -> Result<Self, EncodeError>where
R: Read,
Source§impl<T> FromXml for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromXml for Twhere
T: for<'de> Deserialize<'de>,
fn from_xml_bytes(bytes: &[u8]) -> Result<Self, EncodeError>
fn from_xml_with_reader<R>(reader: R) -> Result<Self, EncodeError>where
R: Read,
fn from_xml(xml: &str) -> Result<Self, EncodeError>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PartialOrdExtension for Twhere
T: PartialOrd,
impl<T> PartialOrdExtension for Twhere
T: PartialOrd,
Source§fn max_partial(self, other: Self) -> Selfwhere
Self: Sized,
fn max_partial(self, other: Self) -> Selfwhere
Self: Sized,
Using
PartialOrd operator, not component wiseSource§fn min_partial(self, other: Self) -> Selfwhere
Self: Sized,
fn min_partial(self, other: Self) -> Selfwhere
Self: Sized,
Using
PartialOrd operator, not component wiseSource§fn clamp_partial(self, min: Self, max: Self) -> Selfwhere
Self: Sized,
fn clamp_partial(self, min: Self, max: Self) -> Selfwhere
Self: Sized,
Using
PartialOrd operator, not component wiseSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PositiveOrNegative for Twhere
T: Zero + PartialOrd,
impl<T> PositiveOrNegative for Twhere
T: Zero + PartialOrd,
Source§fn is_positive_or_zero(&self) -> bool
fn is_positive_or_zero(&self) -> bool
Is >= 0 Read more
Source§fn is_negative_or_zero(&self) -> bool
fn is_negative_or_zero(&self) -> bool
Is <= 0 Read more
Source§fn is_strictly_positive(&self) -> bool
fn is_strictly_positive(&self) -> bool
Is > 0 Read more
Source§fn is_strictly_negative(&self) -> bool
fn is_strictly_negative(&self) -> bool
Is < 0 Read more
Source§impl<I, T> RangeDefaultSampleExtension<I> for T
impl<I, T> RangeDefaultSampleExtension<I> for T
Source§fn sample(nb_sample: I) -> <Range<T> as RangeSampleExtension<I>>::Output ⓘ
fn sample(nb_sample: I) -> <Range<T> as RangeSampleExtension<I>>::Output ⓘ
Sample using the
RangeDefault : Self::RANGE_MIN..Self::MAXSource§impl<I, T> RangeDefaultSampleInclusiveExtension<I> for T
impl<I, T> RangeDefaultSampleInclusiveExtension<I> for T
Source§fn sample_inclusive(
nb_sample: I,
) -> <RangeInclusive<T> as RangeSampleExtension<I>>::Output
fn sample_inclusive( nb_sample: I, ) -> <RangeInclusive<T> as RangeSampleExtension<I>>::Output
Sample using the
RangeDefault : Self::RANGE_MIN..=Self::MAXSource§impl<T> RangeDefaultStepExtension for T
impl<T> RangeDefaultStepExtension for T
Source§fn step(
self,
step: <Range<T> as RangeStepExtension>::Item,
) -> <Range<T> as RangeStepExtension>::Output ⓘ
fn step( self, step: <Range<T> as RangeStepExtension>::Item, ) -> <Range<T> as RangeStepExtension>::Output ⓘ
Step using the
RangeDefault : Self::RANGE_MIN..Self::MAXSource§impl<T> RangeDefaultStepInclusiveExtension for T
impl<T> RangeDefaultStepInclusiveExtension for T
Source§fn step_inclusive(
self,
step: <RangeInclusive<T> as RangeStepExtension>::Item,
) -> <RangeInclusive<T> as RangeStepExtension>::Output
fn step_inclusive( self, step: <RangeInclusive<T> as RangeStepExtension>::Item, ) -> <RangeInclusive<T> as RangeStepExtension>::Output
Step using the
RangeDefault : Self::RANGE_MIN..=Self::MAXSource§impl<T> ToJson for Twhere
T: Serialize,
impl<T> ToJson for Twhere
T: Serialize,
fn to_json(&self) -> Result<String, EncodeError>
fn to_json_with_writer<W>(&self, writer: W) -> Result<(), EncodeError>where
W: Write,
Source§impl<T> ToRon for Twhere
T: Serialize,
impl<T> ToRon for Twhere
T: Serialize,
fn to_ron(&self) -> Result<String, EncodeError>
fn to_ron_with_writer<W>(&self, writer: W) -> Result<(), EncodeError>where
W: Write,
Source§impl<T> ToTmpBin for Twhere
T: Serialize,
impl<T> ToTmpBin for Twhere
T: Serialize,
Source§fn to_tmp_bin(&self) -> Result<Vec<u8>, EncodeError>
fn to_tmp_bin(&self) -> Result<Vec<u8>, EncodeError>
Intended for short-term storage of data in a binary format, such as during data transfer. Read more
Source§fn to_tmp_bin_with_writer<W>(&self, writer: W) -> Result<(), EncodeError>where
W: Write,
fn to_tmp_bin_with_writer<W>(&self, writer: W) -> Result<(), EncodeError>where
W: Write,
Intended for short-term storage of data in a binary format, such as during data transfer. Read more