Helper fns for formatter implementations.

prepend-unread

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (prepend-unread bm batch unread-batch)

Type signature:
  • (BatchManager ⨯ AnyBatch ⨯ AnyBatch) → AnyBatch

Returns batch with prepended data from unread-batch, if any.

string-cat-batch!

Available since version 1.0 (view source)

not referred automatically

VAR of type (Fn [MutableString MutableString (Batch Char)] [MutableString MutableString (Batch Char) IReference] [MutableString MutableString (Batch Char) Int Int IReference])

Returns the catenation of mutable string ms with the [begin, end) section of a batch, using array in state reference as a intermediate array in cases where batch is not backed by one. state is assumed to be a reference to persistent map, optionally holding an array under :alt-arr key.

string-to-batch!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (string-to-batch! s)

  • (string-to-batch! s bm batch)

Type signatures:
  • (String+) → (Batch Char)

  • (String+ ⨯ BatchManager ⨯ AnyBatch) → (Batch Char)

Returns a batch with contents same as a given string s. If batch is given and has enough free space, puts string contents into it and returns nil.

Implementation note: returned batch must have position 0 and limit set to buffers capacity.