baml.iter.Repeat$stream

An iterator that returns the same value a specified number of times.

Reference version

Signature

class baml.iter.Repeat$stream<T>

An iterator that returns the same value a specified number of times.

It yields the same value, not a copy of it: repeating a class instance hands out one shared instance, so mutating a yielded element is visible through every other one. Pair it with map when each round needs its own.

A negative count means "forever", which is the default — bound it with baml.iter.Iterator.take before consuming it.

Source:<builtin>/baml/ns_iter/iter.bamlbytes 0–0

Fields

value

T | null

The value handed out on each next.

count

int | null

How many yields remain, or a negative number for "unbounded".

Implementations

baml.Concrete for T

Source:<builtin>/baml/core.bamlbytes 747–779