Skip to content
StrIterFromZstr

StrIterFromZstr

Description

Construct a forward-walking StrIter over a NUL-terminated Zstr. Alias-reframe of the IterInitFromVec shape: length is taken from ZstrLen(s), alignment is fixed at 1. See IterInitFromVec for the overall borrowed-data semantics.

Parameters

Name Direction Description
s in NUL-terminated string. Must outlive the iterator.

Success

Returns a compound-literal StrIter covering [s, s + ZstrLen(s)) with pos = 0, dir = 1. The NUL terminator is not part of the iterated range.

Failure

Macro cannot fail. Passing a non-NUL-terminated buffer is a usage error – ZstrLen would run past the end.

Usage example (Cross-references)

Usage examples (Cross-references)
        BufIter start     = *iter;
        u64     arg_index = 0;
        StrIter fsi       = StrIterFromZstr(fmtstr);
        char    fc        = 0;
    static bool render_binary_fmt(Str *out, Zstr fmtstr, TypeSpecificIO *argv, u64 argc) {
        u64     arg_index = 0;
        StrIter fsi       = StrIterFromZstr(fmtstr);
        char    fc        = 0;
        while (StrIterPeek(&fsi, &fc)) {
        }
    
        StrIter si = StrIterFromZstr(i);
        char    c  = 0;
        }
    
        StrIter si = StrIterFromZstr(i);
        char    c  = 0;
            }                                                                                                              \
                                                                                                                           \
            StrIter si = StrIterFromZstr(i);                                                                               \
            char    c  = 0;                                                                                                \
                                                                                                                           \
        ValidateBitVec(bv);
    
        StrIter si = StrIterFromZstr(i);
        char    c  = 0;
        ValidateInt(value);
    
        StrIter si = StrIterFromZstr(i);
        char    c  = 0;
        ValidateFloat(value);
    
        StrIter si = StrIterFromZstr(i);
        char    c  = 0;
        }
    
        StrIter si = StrIterFromZstr(i);
        char    c  = 0;
        if (!s || !*s)
            return false;
        StrIter si = StrIterFromZstr(s);
        u64     v  = 0;
        char    c;
            size aug_end_pos = IterIndex(body) + aug_len;
    
            StrIter aug_it = StrIterFromZstr(augmentation + 1);
            char    a;
            while (StrIterRead(&aug_it, &a)) {
            return false;
        }
        StrIter si          = StrIterFromZstr(name);
        u64     total_bytes = 0;
        char    c;
Last updated on