ScalarConstructible

public protocol ScalarConstructible

Types conforming to this protocol can be extracted Node.Scalars.

  • Construct an instance of Self, if possible, from the specified scalar.

    Note

    We use static constructors to avoid overloading init?(_ scalar: Node.Scalar) which would cause callsite ambiguities when using init as closure.

    Declaration

    Swift

    static func construct(from scalar: Node.Scalar) -> Self?

    Parameters

    scalar

    The Node.Scalar from which to extract a value of type Self, if possible.

    Return Value

    An instance of Self, if one was successfully extracted from the scalar.

Available where Self: FloatingPoint & SexagesimalConvertible

  • construct(from:) Default implementation

    Default Implementation

    Construct an instance of FloatingPoint & SexagesimalConvertible, if possible, from the specified scalar.

    Declaration

    Swift

    public static func construct(from scalar: Node.Scalar) -> Self?

    Parameters

    scalar

    The Node.Scalar from which to extract a value of type FloatingPoint & SexagesimalConvertible, if possible.

    Return Value

    An instance of FloatingPoint & SexagesimalConvertible, if one was successfully extracted from the scalar.