TypeOptional

class dsviper.TypeOptional(element_type)

Bases: Type

The optional<element_type> type.

element_type() is the Type it wraps; ValueOptional builds values of it.

static cast(type: Type) → TypeOptional

Return the type optional<element_type> or raise.

description(*, namespace: NameSpace | None = None) → str

Return the same as representation(): optional<element_type>, qualified against namespace.

element_type() → Type

Return the type of the value held when the optional is not nil.

representation(*, namespace: NameSpace | None = None) → str

Return the type written out as optional<element_type>, with the names qualified against namespace - the global namespace when it is None.

runtime_id() → ValueUUId

Return the uuid identifying this type.

It is computed from what the type is, so the same declaration yields the same id in any Definitions. Definitions says what each kind is computed from.

type_code() → str

Return the code naming this kind of type, such as “int32”, “struct” or “vector”.