def string_size

mylsm-lsm-store@0.6.0.1 · src/StorageBytes.bend:105

import mylsm-lsm-store@0.6.0.1/src/StorageBytes.bend as StorageBytes
import Base

105# Returns a string length as a storage byte count.
106def string_size(+text: String) -> Nat:
107  match text:
108    case SNil{}:
109      0n
110    case SCon{Chr{scalar}, rest}:
111      Nat.add(U32.to_nat(utf8.width(scalar)), string_size(rest))

Uses (6)

Used by (3)