devela::_dep::pyo3::prelude

Trait PyComplexMethods

pub trait PyComplexMethods<'py>: Sealed {
    // Required methods
    fn real(&self) -> f64 ;
    fn imag(&self) -> f64 ;
    fn abs(&self) -> f64 ;
    fn pow(&self, other: &Bound<'py, PyComplex>) -> Bound<'py, PyComplex>;
}
Available on crate features dep_pyo3 and std only.
Expand description

Implementation of functionality for PyComplex.

These methods are defined for the Bound<'py, PyComplex> smart pointer, so to use method call syntax these methods are separated into a trait, because stable Rust does not yet support arbitrary_self_types.

Required Methods§

fn real(&self) -> f64

Returns the real part of the complex number.

fn imag(&self) -> f64

Returns the imaginary part of the complex number.

fn abs(&self) -> f64

Returns |self|.

fn pow(&self, other: &Bound<'py, PyComplex>) -> Bound<'py, PyComplex>

Returns self raised to the power of other.

Implementors§

§

impl<'py> PyComplexMethods<'py> for Bound<'py, PyComplex>