Skip to main content

ReprOutput

This class represents the output of a representation operation, providing a mechanism to handle both native Python string objects and fallback UTF-8 strings. It allows for flexible string representation by encapsulating either a bound Python string reference or a standard string buffer.

Attributes

AttributeTypeDescription
PythonBound< 'py, PyString >Stores a reference to a Python string object used when the representation is generated within the Python runtime environment.
FallbackStringStores a standard Rust string used as a backup representation when a Python-bound string cannot be utilized.

Constructor

Signature

def ReprOutput()

Signature

def Python(
value: Bound< 'py, PyString >
) - > [ReprOutput](reproutput.md?sid=tools_reproutput)

Parameters

NameTypeDescription
valueBound< 'py, PyString >The bound Python string object to be returned as the representation.

Signature

def Fallback(
value: String
) - > [ReprOutput](reproutput.md?sid=tools_reproutput)

Parameters

NameTypeDescription
valueStringThe UTF-8 encoded string to use as the fallback representation.