Explorer

std.string-to-utf8-stream

description
Convert a string into a UTF-8 pull-based byte stream ({ initialState, next })
type
Fn(text: String) -> Record{
  initialState: Number,
  next: Fn(state: Number) -> Union{#yield(Record{chunk: List<Number>, nextState: Number}), #done}
}
expression
fn(text$1) =>
  {
    initialState: 0,
    next: fn(state$2) =>
      match @core.and(
          left: @core.equal(left: $2, right: 0),
          right: @core.greater-than(left: @core.string-length(value: $1), right: 0)
        ) {
        true =>
          #yield({chunk: @core.string-to-bytes(value: $1), nextState: 1}),
        false =>
          #done
      }
  }
visibility
public
std.string-to-utf8-stream (project definy, branch accept-new-accounts, snapshot XoN1SzeSljKEq7A884S1VlWxMBcoS3Syt0cee07GVH0)
id: U9xJ_UsIq7hilgS1aWzFi1BoH-pWYTuWVr1FcA3ugkg
content hash: 2Ig-7sxA-LzrflaCKVefL4V7KcmfHwdd4Pq126YE7XU