pub struct PyRot2(/* private fields */);Implementations§
Source§impl PyRot2
impl PyRot2
pub fn new(cos: Option<f32>, sin: Option<f32>) -> Self
pub fn identity() -> Self
pub fn pi() -> Self
pub fn frac_pi_2() -> Self
pub fn frac_pi_3() -> Self
pub fn frac_pi_4() -> Self
pub fn frac_pi_6() -> Self
pub fn frac_pi_8() -> Self
pub fn radians(radians: f32) -> Self
pub fn degrees(degrees: f32) -> Self
pub fn turn_fraction(fraction: f32) -> Self
pub fn from_sin_cos(sin: f32, cos: f32) -> Self
pub fn cos(&self) -> f32
pub fn sin(&self) -> f32
pub fn as_radians(&self) -> f32
pub fn as_degrees(&self) -> f32
pub fn as_turn_fraction(&self) -> f32
pub fn inverse(&self) -> Self
pub fn sin_cos(&self) -> (f32, f32)
pub fn length(&self) -> f32
pub fn length_squared(&self) -> f32
pub fn length_recip(&self) -> f32
pub fn try_normalize(&self) -> Option<Self>
pub fn is_normalized(&self) -> bool
pub fn normalize(&self) -> Self
pub fn fast_renormalize(&self) -> Self
pub fn is_near_identity(&self) -> bool
pub fn is_finite(&self) -> bool
pub fn is_nan(&self) -> bool
pub fn angle_to(&self, other: PyRot2) -> f32
pub fn rotate(&self, vec: PyVec2) -> PyVec2
pub fn slerp(&self, rhs: PyRot2, s: f32) -> Self
pub fn nlerp(&self, rhs: PyRot2, s: f32) -> Self
pub fn interpolate_stable(&self, other: PyRot2, t: f32) -> Self
pub fn interpolate_stable_assign(&mut self, other: PyRot2, t: f32)
pub fn smooth_nudge(&mut self, target: PyRot2, decay_rate: f32, delta: f32)
pub fn __mul__(&self, other: PyRot2) -> Self
pub fn __repr__(&self) -> String
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for PyRot2
impl<'py> IntoPyObject<'py> for PyRot2
Source§type Output = Bound<'py, <PyRot2 as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <PyRot2 as IntoPyObject<'py>>::Target>
The smart pointer type to use. Read more
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Performs the conversion.
Source§impl PyClassImpl for PyRot2
impl PyClassImpl for PyRot2
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
#[pyclass(subclass)]
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
#[pyclass(extends=…)]
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
#[pyclass(mapping)]
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
#[pyclass(sequence)]
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
#[pyclass(immutable_type)]
Source§const RAW_DOC: &'static CStr = c"\x00"
const RAW_DOC: &'static CStr = c"\x00"
Docstring for the class provided on the struct or enum. Read more
Source§const DOC: &'static CStr
const DOC: &'static CStr
Fully rendered class doc, including the
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<PyRot2>
type ThreadChecker = SendablePyClass<PyRot2>
This handles following two situations: Read more
type Inventory = Pyo3MethodsInventoryForPyRot2
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Immutable or mutable
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
The closest native ancestor. This is
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyClassNewTextSignature for PyRot2
impl PyClassNewTextSignature for PyRot2
const TEXT_SIGNATURE: &'static str = "(*, cos=None, sin=None)"
Source§impl PyTypeInfo for PyRot2
impl PyTypeInfo for PyRot2
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
Returns the PyTypeObject instance for this type.
Source§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
Returns the safe abstraction over the type object.
impl Copy for PyRot2
impl DerefToPyAny for PyRot2
impl ExtractPyClassWithClone for PyRot2
impl StructuralPartialEq for PyRot2
Auto Trait Implementations§
impl Freeze for PyRot2
impl RefUnwindSafe for PyRot2
impl Send for PyRot2
impl Sync for PyRot2
impl Unpin for PyRot2
impl UnsafeUnpin for PyRot2
impl UnwindSafe for PyRot2
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<'a, 'py, T> FromPyObject<'a, 'py> for T
impl<'a, 'py, T> FromPyObject<'a, 'py> for T
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<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
Source§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
Converts
self into an owned Python object, dropping type information.Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
Source§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
Source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
Source§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
👎Deprecated since 0.27.0:
Use ::classinfo_object() instead and format the type name at runtime. Note that using built-in cast features is often better than manual PyTypeCheck usage.
Name of self. This is used in error messages, for example.
Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
Creates a type-erased clone of this value.