TypedValue

open class TypedValue : OptionalRustObject

A wrapper around Mentat’s TypedValue Rust object. This class wraps a raw pointer to a Rust TypedValue struct and provides accessors to the values according to expected result type.

As the FFI functions for fetching values are consuming, this class keeps a copy of the result internally after fetching so that the value can be referenced several times.

Also, due to the consuming nature of the FFI layer, this class also manages it’s raw pointer, nilling it after calling the FFI conversion function so that the underlying base class can manage cleanup.

  • This value as a Int64. This function will panic if the ValueType of this TypedValue is not a Long

    Declaration

    Swift

    open func asLong() -> Int64

    Return Value

    the value of this TypedValue as a Int64

  • This value as an Entid. This function will panic if the ValueType of this TypedValue is not a Ref

    Declaration

    Swift

    open func asEntid() -> Entid

    Return Value

    the value of this TypedValue as an Entid

  • This value as a keyword String. This function will panic if the ValueType of this TypedValue is not a Keyword

    Declaration

    Swift

    open func asKeyword() -> String

    Return Value

    the value of this TypedValue as a keyword String

  • This value as a Bool. This function will panic if the ValueType of this TypedValue is not a Boolean

    Declaration

    Swift

    open func asBool() -> Bool

    Return Value

    the value of this TypedValue as a Bool

  • This value as a Double. This function will panic if the ValueType of this TypedValue is not a Double

    Declaration

    Swift

    open func asDouble() -> Double

    Return Value

    the value of this TypedValue as a Double

  • This value as a Date. This function will panic if the ValueType of this TypedValue is not a Instant

    Declaration

    Swift

    open func asDate() -> Date

    Return Value

    the value of this TypedValue as a Date

  • This value as a String. This function will panic if the ValueType of this TypedValue is not a String

    Declaration

    Swift

    open func asString() -> String

    Return Value

    the value of this TypedValue as a String

  • This value as a UUID. This function will panic if the ValueType of this TypedValue is not a Uuid

    Declaration

    Swift

    open func asUUID() -> UUID?

    Return Value

    the value of this TypedValue as a UUID?. If the UUID is not valid then this function returns nil.

  • Undocumented

    Declaration

    Swift

    override open func cleanup(pointer: OpaquePointer)