OptionalValue

public struct OptionalValue<T> : ECHOCodable where T : ECHOCodable

Container template class used whenever we have an optional field.

The idea here is that the binary serialization of this field should be performed in a specific way determined by the field implementing the {@link ByteSerializable} interface, more specifically using the {@link ByteSerializable#toBytes()} method.

However, if the field is missing, the Optional class should be able to know how to serialize it, as this is always done by placing an zero byte.

  • Undocumented

    Declaration

    Swift

    public let object: T?
  • Undocumented

    Declaration

    Swift

    public init(_ object: T?, addByteToStart: Bool = false)
  • Undocumented

    Declaration

    Swift

    public func isSet() -> Bool
  • Undocumented

    Declaration

    Swift

    public func toJSON() -> Any?
  • Undocumented

    Declaration

    Swift

    public func toJSON() -> String?
  • Undocumented

    Declaration

    Swift

    public func toData() -> Data?