Skip to main content

PyComplexMethods

Trait PyComplexMethods 

Source
pub trait PyComplexMethods<'py>: Sealed {
    // Required methods
    fn real(&self) -> c_double;
    fn imag(&self) -> c_double;
    fn abs(&self) -> c_double;
    fn pow(&self, other: &Bound<'py, PyComplex>) -> Bound<'py, PyComplex>;
}
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§

Source

fn real(&self) -> c_double

Returns the real part of the complex number.

Source

fn imag(&self) -> c_double

Returns the imaginary part of the complex number.

Source

fn abs(&self) -> c_double

Available on neither GraalPy nor Py_LIMITED_API nor PyPy.

Returns |self|.

Source

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

Available on neither GraalPy nor Py_LIMITED_API nor PyPy.

Returns self raised to the power of other.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

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

⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here