ScalarConstructible
public protocol ScalarConstructible
Types conforming to this protocol can be extracted Node.Scalar
s.
-
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 usinginit
as closure.Declaration
Swift
static func construct(from scalar: Node.Scalar) -> Self?
Parameters
scalar
The
Node.Scalar
from which to extract a value of typeSelf
, if possible.Return Value
An instance of
Self
, if one was successfully extracted from the scalar.
-
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 typeFloatingPoint & SexagesimalConvertible
, if possible.Return Value
An instance of
FloatingPoint & SexagesimalConvertible
, if one was successfully extracted from the scalar.