StringIndex
public protocol StringIndexProtocol for typed string indices. Each index wraps a pre-resolved byte offset; the type tag determines what unit the index addresses and what the subscript returns.
Associated Types
type Yield
type YieldMethods
func read(from: StringSlice) -> Yield
func read(from: StringSlice) -> YieldImplementsEquatable
Associated Types
type Output = Bool
type Output = BoolMethods
public func equal(to: Self) -> Bool
public func equal(to: Self) -> BoolBridges Equal.equal(to:) to Equatable.isEqual(to:).
func isEqual(to: Self) -> Bool
func isEqual(to: Self) -> BoolReturns true iff self and other are considered equal. Should
be reflexive, symmetric, and transitive — Hashable requires equal
values to hash equal, so don't drift from those laws.
public func notEqual(to: Self) -> Bool
public func notEqual(to: Self) -> BoolDefault !=: delegates to == so there's a single source of truth.
ImplementsComparable
Associated Types
type Output = Bool
type Output = BoolMethods
func compare(Self) -> Ordering
func compare(Self) -> OrderingReturns the ordering of self relative to other. Must be a
total order — for any a, b, c exactly one of Less,
Equal, Greater holds, and the order is transitive.
public func greaterThan(Self) -> Bool
public func greaterThan(Self) -> Bool> derived from compare.
public func greaterThanOrEqual(Self) -> Bool
public func greaterThanOrEqual(Self) -> Bool>= derived from compare.
public func isAtLeast(Self) -> Bool
public func isAtLeast(Self) -> Boolstart.. lower-bound check, derived from compare.
public func isAtMost(Self) -> Bool
public func isAtMost(Self) -> Bool..=end upper-bound check, derived from compare.
public func isBelow(Self) -> Bool
public func isBelow(Self) -> Bool..<end upper-bound check, derived from compare.
public func lessThan(Self) -> Bool
public func lessThan(Self) -> Bool< derived from compare.
public func lessThanOrEqual(Self) -> Bool
public func lessThanOrEqual(Self) -> Bool<= derived from compare.
Defined in lang/std/text/slice.ks