Interpolatable
public protocol InterpolatableProtocol for the accumulator type that string interpolation builds into.
The compiler lowers "hello, \{name}!" to a sequence of
appendLiteral and appendInterpolation calls on a fresh value of
the implementor's type, then reads the final string out (typically
via a build() method on the concrete accumulator). String ships
DefaultStringInterpolation as its accumulator; custom string-like
types can supply their own to intercept literal pieces or coerce
formatted parts.
Initializers
init(literalCapacity: Int64, interpolationCount: Int64)
init(literalCapacity: Int64, interpolationCount: Int64)Constructs an empty accumulator with capacity hints derived from the literal at compile time.
literalCapacity is the total byte count of the static segments;
interpolationCount is the number of \{...} holes. Implementors
can use these to preallocate.
Methods
mutating func appendLiteral(String)
mutating func appendLiteral(String)Appends a static literal segment.
Called once per run of literal text between \{...} holes. May be
called with the empty string; implementors should be cheap in
that case.
Defined in lang/std/text/format.ks