Function findTag

Find the first tag with exactly matching key bytes.

TagLookupResult findTag(R, Q)(
  scope return R tags,
  scope Q[] key
) nothrow @nogc @safe
if (isSemanticTagRange!R && isTagCodeUnit!Q);

The query may be supplied as ubyte[] or D char[]. A D string is compared as its existing UTF-8 code units; no decoding, normalization, transcoding, case folding, or allocation occurs.

Duplicate keys are preserved by the underlying cursor. This function returns the first matching occurrence in cursor order.

Parameters

NameDescription
tags Borrowed semantic tag range/cursor exposing empty, front and popFront. The cursor is consumed by value; the caller's cursor is not advanced.
key Exact key bytes/code units to match.

Returns

A TagLookupResult. Its tag borrows the same backing storage as tags when found is true.

Safety

No allocation or normalization is performed. The return scope parameter ties a successful borrowed result to the supplied cursor's lifetime under DIP1000.