Skip to content

Structure

LeafData

LeafData is a “pseudo-protocol” wrapping the physically storable Swift data types Leaf can use directly
struct LeafData

Overview

  • (Bool, Int, Double, String, Array, Dictionary, Data) are the inherent root types supported, all of which may also be representable as Optional values.

  • NaturalType presents these cases plus Void as a case for functional LeafSymbols

  • nil is creatable, but only within context of a root base type - eg, .nil(.bool) == Bool?

Topics

Operators

  • ==(_:_:)
    Returns a Boolean value indicating whether two values are equal.

Initializers

Instance Properties

  • array
    Attempts to convert to [LeafData] or returns nil.
  • bool
    Attempts to convert to Bool or returns nil.
  • celf
    The case-self identity
  • data
    Attempts to convert to Data or returns nil.
  • description
    A textual representation of this instance.
  • dictionary
    Attempts to convert to [String: LeafData] or returns nil.
  • double
    Attempts to convert to Double or returns nil.
  • hasUniformType
    Returns true if the object has a single uniform type
  • int
    Attempts to convert to Int or returns nil.
  • isCollection
    Returns true if the data can hold other data - we don’t consider Optional for this purpose
  • isNil
    Returns true if the data is nil or void.
  • short
  • string
    Attempts to convert to String or returns nil.
  • uniformType
    Returns the uniform type of the object, or nil if it is a non-uniform container

Instance Methods

Type Properties

  • trueNil
    For convenience, trueNil is stored as .optional(nil, .void)

Type Methods

  • array(_:)
    Creates a new LeafData from [LeafData].
  • bool(_:)
    Creates a new LeafData from a Bool.
  • data(_:)
    Creates a new LeafData from Data.
  • dictionary(_:)
    Creates a new LeafData from [String: LeafData].
  • double(_:)
    Creates a new LeafData from a Double.
  • int(_:)
    Creates a new LeafData from am Int.
  • nil(_:)
    Creates a new LeafData for Optional<LeafData>
  • string(_:)
    Creates a new LeafData from a String.

Enumerations

Relationships

Conforms To

  • Swift.CustomStringConvertible
  • Swift.Equatable
  • Swift.ExpressibleByArrayLiteral
  • Swift.ExpressibleByBooleanLiteral
  • Swift.ExpressibleByDictionaryLiteral
  • Swift.ExpressibleByExtendedGraphemeClusterLiteral
  • Swift.ExpressibleByFloatLiteral
  • Swift.ExpressibleByIntegerLiteral
  • Swift.ExpressibleByNilLiteral
  • Swift.ExpressibleByStringLiteral
  • Swift.ExpressibleByUnicodeScalarLiteral
  • Swift.Sendable
  • Swift.SendableMetatype