baml.iter.Done

The sentinel `baml.iter.Iterator.next` returns when there are no elements left.

Reference version

Signature

class baml.iter.Done

The sentinel baml.iter.Iterator.next returns when there are no elements left.

next returns Self.Item | Done rather than Self.Item? because an iterator's item type may itself be nullable: an iterator over string? has to be able to yield a stored null without that being read as the end of the sequence. A separate sentinel type keeps the two apart, and match tells them apart by type rather than by value.

It carries no data — every Done is interchangeable — so it is written Done {} at a construction site.

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

Implementations

baml.Concrete for T

Source:<builtin>/baml/core.bamlbytes 763–795