Struct golden_apple::Angle
source · [−]pub struct Angle { /* private fields */ }
Expand description
Represents an angle. Cannot be greater than one full rotation, does not have negative values.
Implementations
sourceimpl Angle
impl Angle
sourcepub fn from_bytes(bytes: &[u8]) -> Result<(Angle, usize), Error>
pub fn from_bytes(bytes: &[u8]) -> Result<(Angle, usize), Error>
Creates a new Angle
using a byte. The byte is expected to reperesent how many 256ths of a
full turn this angle represents. Always uses a single byte.
sourcepub fn from_degrees(degrees: f64) -> Angle
pub fn from_degrees(degrees: f64) -> Angle
Creates a new Angle
that is the given amount of degrees. Absoulte value is taken for
negative values. Values over a full turn have the amount of turns discarded. Some
significant precision is lost switching to Minecraft’s format.
sourcepub fn from_radians(radians: f64) -> Angle
pub fn from_radians(radians: f64) -> Angle
Creates a new Angle
that is the given amount of radians. Absoulte value is taken for
negative values. Values over a full turn have the amount of turns discarded. Some
significant precision is lost switching to Minecraft’s format.
sourcepub fn as_256ths(self) -> u8
pub fn as_256ths(self) -> u8
Returns how many 256ths of a full turn this angle represents. This is the data’s actual format, and the most exact representation.
sourcepub fn to_degrees(self) -> f64
pub fn to_degrees(self) -> f64
Returns how many degrees this angle represents.
sourcepub fn to_radians(self) -> f64
pub fn to_radians(self) -> f64
Returns how many radians this angle represents.
Trait Implementations
sourceimpl PartialEq<Angle> for Angle
impl PartialEq<Angle> for Angle
impl Copy for Angle
impl Eq for Angle
impl StructuralEq for Angle
impl StructuralPartialEq for Angle
Auto Trait Implementations
impl RefUnwindSafe for Angle
impl Send for Angle
impl Sync for Angle
impl Unpin for Angle
impl UnwindSafe for Angle
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more