Skip to main content

EitherComplex

This class represents a value that can be either a raw pair of 64-bit floating-point numbers representing a complex value or a reference to a Python complex object. It provides a flexible interface for handling complex number data across the Python-Rust boundary.

Attributes

AttributeTypeDescription
Complex[f64; 2]Stores a complex number as a fixed-size array of two 64-bit floats representing the real and imaginary parts.
PyBound< 'py, PyComplex >Holds a reference to a Python complex number object for interoperability with the Python C-API.

Constructor

Signature

def Complex(
value: [f64; 2]
) - > [EitherComplex](eithercomplex.md?sid=input_return_enums_eithercomplex)

Parameters

NameTypeDescription
value[f64; 2]A two-element array containing the real and imaginary components of the complex number.

Signature

def Py(
value: Bound< 'py, PyComplex >
) - > [EitherComplex](eithercomplex.md?sid=input_return_enums_eithercomplex)

Parameters

NameTypeDescription
valueBound< 'py, PyComplex >A bound reference to a PyComplex object from the Python C-API.