logos.lang.str

Module lang · package logos-lang

Traits

traitPattern

trait Pattern

A searchable pattern over str haystacks; implemented for str (substring) and u8 (byte).

Implemented by: str u8 u32

Types

structBytes

struct Bytes

Iterator over the raw bytes of a string slice, with no UTF-8 decoding.

Implements: Iterator

Fields

len: i64
pos: i64
ptr: *const u8

Methods

fn all(self: Bytes, pred: AllFn) -> bool
fn any(self: Bytes, pred: AnyFn) -> bool
fn chain(self: Bytes, other: ChainOther) -> ChainIter<Bytes, ChainOther, u8>
fn collect(self: Bytes) -> C
fn count(self: Bytes) -> i64
fn enumerate(self: Bytes) -> EnumIter<Bytes, u8>
fn filter(self: Bytes, pred: fn(u8) -> bool) -> FilterIter<Bytes, u8>
fn find(self: &mut Bytes, pred: FindFn) -> Option
fn find_map(self: Bytes, f: FindMapFn) -> Option
fn fold(self: Bytes, init: Acc, f: FoldFn) -> Acc
fn for_each(self: Bytes, f: EachFn) -> void
fn inspect(self: Bytes, visit: fn(u8) -> void, zero: u8) -> InspectIter<Bytes, u8>
fn last(self: Bytes) -> Option
fn map(self: Bytes, f: MapFn) -> MapIter<Bytes, u8, MapOut, MapFn>
fn max(self: Bytes) -> Option
fn max_by(self: Bytes, cmp: fn(u8, u8) -> i32) -> Option
fn min(self: Bytes) -> Option
fn min_by(self: Bytes, cmp: fn(u8, u8) -> i32) -> Option
fn next(self: &mut Bytes) -> Option
fn nth(self: &mut Bytes, n: i64) -> Option
fn peekable(self: Bytes) -> PeekableIter<Bytes, u8>
fn position(self: &mut Bytes, pred: PosFn) -> Option
fn product(self: Bytes) -> S
fn reduce(self: Bytes, f: ReduceFn) -> Option
fn skip(self: Bytes, n: i64) -> SkipIter<Bytes, u8>
fn skip_while(self: Bytes, pred: fn(u8) -> bool, zero: u8) -> SkipWhileIter<Bytes, u8>
fn step_by(self: Bytes, step: i64, zero: u8) -> StepByIter<Bytes, u8>
fn sum(self: Bytes) -> S
fn take(self: Bytes, n: i64) -> TakeIter<Bytes, u8>
fn take_while(self: Bytes, pred: fn(u8) -> bool, zero: u8) -> TakeWhileIter<Bytes, u8>
fn try_fold(self: Bytes, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: Bytes, f: TryEachFn) -> ControlFlow
fn zip(self: Bytes, other: ZipOther) -> ZipIter<Bytes, ZipOther, u8, ZipOtherItem>

structByteSplitter

struct ByteSplitter

Yields substrings of the input separated by a fixed single-byte separator.

Common fast path for ',', '/', etc. Segments are sub-str views into the original buffer, which must outlive iteration.

Implements: Iterator

Fields

done: bool
rest: &[u8]
sep: u8

Methods

fn all(self: ByteSplitter, pred: AllFn) -> bool
fn any(self: ByteSplitter, pred: AnyFn) -> bool
fn chain(self: ByteSplitter, other: ChainOther) -> ChainIter<ByteSplitter, ChainOther, &[u8]>
fn collect(self: ByteSplitter) -> C
fn count(self: ByteSplitter) -> i64
fn enumerate(self: ByteSplitter) -> EnumIter<ByteSplitter, &[u8]>
fn filter(self: ByteSplitter, pred: fn(&[u8]) -> bool) -> FilterIter<ByteSplitter, &[u8]>
fn find(self: &mut ByteSplitter, pred: FindFn) -> Option
fn find_map(self: ByteSplitter, f: FindMapFn) -> Option
fn fold(self: ByteSplitter, init: Acc, f: FoldFn) -> Acc
fn for_each(self: ByteSplitter, f: EachFn) -> void
fn inspect(self: ByteSplitter, visit: fn(&[u8]) -> void, zero: &[u8]) -> InspectIter<ByteSplitter, &[u8]>
fn last(self: ByteSplitter) -> Option
fn map(self: ByteSplitter, f: MapFn) -> MapIter<ByteSplitter, &[u8], MapOut, MapFn>
fn max(self: ByteSplitter) -> Option
fn max_by(self: ByteSplitter, cmp: fn(&[u8], &[u8]) -> i32) -> Option
fn min(self: ByteSplitter) -> Option
fn min_by(self: ByteSplitter, cmp: fn(&[u8], &[u8]) -> i32) -> Option
fn next(self: &mut ByteSplitter) -> Option
fn nth(self: &mut ByteSplitter, n: i64) -> Option
fn peekable(self: ByteSplitter) -> PeekableIter<ByteSplitter, &[u8]>
fn position(self: &mut ByteSplitter, pred: PosFn) -> Option
fn product(self: ByteSplitter) -> S
fn reduce(self: ByteSplitter, f: ReduceFn) -> Option
fn skip(self: ByteSplitter, n: i64) -> SkipIter<ByteSplitter, &[u8]>
fn skip_while(self: ByteSplitter, pred: fn(&[u8]) -> bool, zero: &[u8]) -> SkipWhileIter<ByteSplitter, &[u8]>
fn step_by(self: ByteSplitter, step: i64, zero: &[u8]) -> StepByIter<ByteSplitter, &[u8]>
fn sum(self: ByteSplitter) -> S
fn take(self: ByteSplitter, n: i64) -> TakeIter<ByteSplitter, &[u8]>
fn take_while(self: ByteSplitter, pred: fn(&[u8]) -> bool, zero: &[u8]) -> TakeWhileIter<ByteSplitter, &[u8]>
fn try_fold(self: ByteSplitter, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: ByteSplitter, f: TryEachFn) -> ControlFlow
fn zip(self: ByteSplitter, other: ZipOther) -> ZipIter<ByteSplitter, ZipOther, &[u8], ZipOtherItem>

structCharIndex

struct CharIndex

A byte-offset + codepoint pair yielded by CharIndices.

Fields

ch: u32

The decoded codepoint (U+FFFD for invalid input).

idx: i64

Byte offset of the codepoint’s first byte in the source slice.

structCharIndices

struct CharIndices

Iterator over the codepoints of a string slice together with their byte offsets.

Implements: Iterator

Fields

len: i64
pos: i64
ptr: *const u8

Methods

fn all(self: CharIndices, pred: AllFn) -> bool
fn any(self: CharIndices, pred: AnyFn) -> bool
fn chain(self: CharIndices, other: ChainOther) -> ChainIter<CharIndices, ChainOther, CharIndex>
fn collect(self: CharIndices) -> C
fn count(self: CharIndices) -> i64
fn enumerate(self: CharIndices) -> EnumIter<CharIndices, CharIndex>
fn filter(self: CharIndices, pred: fn(CharIndex) -> bool) -> FilterIter<CharIndices, CharIndex>
fn find(self: &mut CharIndices, pred: FindFn) -> Option
fn find_map(self: CharIndices, f: FindMapFn) -> Option
fn fold(self: CharIndices, init: Acc, f: FoldFn) -> Acc
fn for_each(self: CharIndices, f: EachFn) -> void
fn inspect(self: CharIndices, visit: fn(CharIndex) -> void, zero: CharIndex) -> InspectIter<CharIndices, CharIndex>
fn last(self: CharIndices) -> Option
fn map(self: CharIndices, f: MapFn) -> MapIter<CharIndices, CharIndex, MapOut, MapFn>
fn max_by(self: CharIndices, cmp: fn(CharIndex, CharIndex) -> i32) -> Option
fn min_by(self: CharIndices, cmp: fn(CharIndex, CharIndex) -> i32) -> Option
fn next(self: &mut CharIndices) -> Option
fn nth(self: &mut CharIndices, n: i64) -> Option
fn peekable(self: CharIndices) -> PeekableIter<CharIndices, CharIndex>
fn position(self: &mut CharIndices, pred: PosFn) -> Option
fn product(self: CharIndices) -> S
fn reduce(self: CharIndices, f: ReduceFn) -> Option
fn skip(self: CharIndices, n: i64) -> SkipIter<CharIndices, CharIndex>
fn skip_while(self: CharIndices, pred: fn(CharIndex) -> bool, zero: CharIndex) -> SkipWhileIter<CharIndices, CharIndex>
fn step_by(self: CharIndices, step: i64, zero: CharIndex) -> StepByIter<CharIndices, CharIndex>
fn sum(self: CharIndices) -> S
fn take(self: CharIndices, n: i64) -> TakeIter<CharIndices, CharIndex>
fn take_while(self: CharIndices, pred: fn(CharIndex) -> bool, zero: CharIndex) -> TakeWhileIter<CharIndices, CharIndex>
fn try_fold(self: CharIndices, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: CharIndices, f: TryEachFn) -> ControlFlow
fn zip(self: CharIndices, other: ZipOther) -> ZipIter<CharIndices, ZipOther, CharIndex, ZipOtherItem>

structChars

struct Chars

Iterator over the Unicode codepoints (u32) of a UTF-8 byte slice. Invalid sequences yield one U+FFFD, advancing by the lead byte’s declared length; a truncated tail yields one U+FFFD per remaining byte.

Implements: Iterator

Fields

len: i64
pos: i64
ptr: *const u8

Methods

fn all(self: Chars, pred: AllFn) -> bool
fn any(self: Chars, pred: AnyFn) -> bool
fn chain(self: Chars, other: ChainOther) -> ChainIter<Chars, ChainOther, u32>
fn collect(self: Chars) -> C
fn count(self: Chars) -> i64
fn enumerate(self: Chars) -> EnumIter<Chars, u32>
fn filter(self: Chars, pred: fn(u32) -> bool) -> FilterIter<Chars, u32>
fn find(self: &mut Chars, pred: FindFn) -> Option
fn find_map(self: Chars, f: FindMapFn) -> Option
fn fold(self: Chars, init: Acc, f: FoldFn) -> Acc
fn for_each(self: Chars, f: EachFn) -> void
fn inspect(self: Chars, visit: fn(u32) -> void, zero: u32) -> InspectIter<Chars, u32>
fn last(self: Chars) -> Option
fn map(self: Chars, f: MapFn) -> MapIter<Chars, u32, MapOut, MapFn>
fn max(self: Chars) -> Option
fn max_by(self: Chars, cmp: fn(u32, u32) -> i32) -> Option
fn min(self: Chars) -> Option
fn min_by(self: Chars, cmp: fn(u32, u32) -> i32) -> Option
fn next(self: &mut Chars) -> Option
fn nth(self: &mut Chars, n: i64) -> Option
fn peekable(self: Chars) -> PeekableIter<Chars, u32>
fn position(self: &mut Chars, pred: PosFn) -> Option
fn product(self: Chars) -> S
fn reduce(self: Chars, f: ReduceFn) -> Option
fn skip(self: Chars, n: i64) -> SkipIter<Chars, u32>
fn skip_while(self: Chars, pred: fn(u32) -> bool, zero: u32) -> SkipWhileIter<Chars, u32>
fn step_by(self: Chars, step: i64, zero: u32) -> StepByIter<Chars, u32>
fn sum(self: Chars) -> S
fn take(self: Chars, n: i64) -> TakeIter<Chars, u32>
fn take_while(self: Chars, pred: fn(u32) -> bool, zero: u32) -> TakeWhileIter<Chars, u32>
fn try_fold(self: Chars, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: Chars, f: TryEachFn) -> ControlFlow
fn zip(self: Chars, other: ZipOther) -> ZipIter<Chars, ZipOther, u32, ZipOtherItem>

structLines

struct Lines

Iterator over the lines of a string slice, split on \n with a preceding \r stripped. A trailing newline does not produce a final empty line (Rust str::lines semantics).

Implements: Iterator

Fields

len: i64
pos: i64
ptr: *const u8

Methods

fn all(self: Lines, pred: AllFn) -> bool
fn any(self: Lines, pred: AnyFn) -> bool
fn chain(self: Lines, other: ChainOther) -> ChainIter<Lines, ChainOther, &[u8]>
fn collect(self: Lines) -> C
fn count(self: Lines) -> i64
fn enumerate(self: Lines) -> EnumIter<Lines, &[u8]>
fn filter(self: Lines, pred: fn(&[u8]) -> bool) -> FilterIter<Lines, &[u8]>
fn find(self: &mut Lines, pred: FindFn) -> Option
fn find_map(self: Lines, f: FindMapFn) -> Option
fn fold(self: Lines, init: Acc, f: FoldFn) -> Acc
fn for_each(self: Lines, f: EachFn) -> void
fn inspect(self: Lines, visit: fn(&[u8]) -> void, zero: &[u8]) -> InspectIter<Lines, &[u8]>
fn last(self: Lines) -> Option
fn map(self: Lines, f: MapFn) -> MapIter<Lines, &[u8], MapOut, MapFn>
fn max(self: Lines) -> Option
fn max_by(self: Lines, cmp: fn(&[u8], &[u8]) -> i32) -> Option
fn min(self: Lines) -> Option
fn min_by(self: Lines, cmp: fn(&[u8], &[u8]) -> i32) -> Option
fn next(self: &mut Lines) -> Option
fn nth(self: &mut Lines, n: i64) -> Option
fn peekable(self: Lines) -> PeekableIter<Lines, &[u8]>
fn position(self: &mut Lines, pred: PosFn) -> Option
fn product(self: Lines) -> S
fn reduce(self: Lines, f: ReduceFn) -> Option
fn skip(self: Lines, n: i64) -> SkipIter<Lines, &[u8]>
fn skip_while(self: Lines, pred: fn(&[u8]) -> bool, zero: &[u8]) -> SkipWhileIter<Lines, &[u8]>
fn step_by(self: Lines, step: i64, zero: &[u8]) -> StepByIter<Lines, &[u8]>
fn sum(self: Lines) -> S
fn take(self: Lines, n: i64) -> TakeIter<Lines, &[u8]>
fn take_while(self: Lines, pred: fn(&[u8]) -> bool, zero: &[u8]) -> TakeWhileIter<Lines, &[u8]>
fn try_fold(self: Lines, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: Lines, f: TryEachFn) -> ControlFlow
fn zip(self: Lines, other: ZipOther) -> ZipIter<Lines, ZipOther, &[u8], ZipOtherItem>

structMatches

struct Matches

Iterator over the non-overlapping matches of a pattern in a string slice. A zero-length match advances one byte, so empty patterns cannot loop forever.

Implements: Iterator

Fields

haystack: &[u8]
pat: P
pos: i64

structMatchIndices

struct MatchIndices

Iterator over non-overlapping pattern matches together with their byte offsets.

Implements: Iterator

Fields

haystack: &[u8]
pat: P
pos: i64

structParseBoolError

struct ParseBoolError

Error returned by bool_from_str; opaque (no fields), mirroring Rust.

structSplitPat

struct SplitPat

Generic pattern-driven splitter over a str, parameterized by any Pattern type.

Segments are sub-str views into the original buffer, which must outlive iteration.

Implements: Iterator

Fields

done: bool
haystack: &[u8]
pat: P
pos: i64

structSplitter

struct Splitter

Yields substrings of the input separated by a fixed multi-byte str separator.

Segments are sub-str views into the original buffer, which must outlive iteration.

Implements: Iterator

Fields

done: bool
rest: &[u8]
sep: &[u8]

Methods

fn all(self: Splitter, pred: AllFn) -> bool
fn any(self: Splitter, pred: AnyFn) -> bool
fn chain(self: Splitter, other: ChainOther) -> ChainIter<Splitter, ChainOther, &[u8]>
fn collect(self: Splitter) -> C
fn count(self: Splitter) -> i64
fn enumerate(self: Splitter) -> EnumIter<Splitter, &[u8]>
fn filter(self: Splitter, pred: fn(&[u8]) -> bool) -> FilterIter<Splitter, &[u8]>
fn find(self: &mut Splitter, pred: FindFn) -> Option
fn find_map(self: Splitter, f: FindMapFn) -> Option
fn fold(self: Splitter, init: Acc, f: FoldFn) -> Acc
fn for_each(self: Splitter, f: EachFn) -> void
fn inspect(self: Splitter, visit: fn(&[u8]) -> void, zero: &[u8]) -> InspectIter<Splitter, &[u8]>
fn last(self: Splitter) -> Option
fn map(self: Splitter, f: MapFn) -> MapIter<Splitter, &[u8], MapOut, MapFn>
fn max(self: Splitter) -> Option
fn max_by(self: Splitter, cmp: fn(&[u8], &[u8]) -> i32) -> Option
fn min(self: Splitter) -> Option
fn min_by(self: Splitter, cmp: fn(&[u8], &[u8]) -> i32) -> Option
fn next(self: &mut Splitter) -> Option
fn nth(self: &mut Splitter, n: i64) -> Option
fn peekable(self: Splitter) -> PeekableIter<Splitter, &[u8]>
fn position(self: &mut Splitter, pred: PosFn) -> Option
fn product(self: Splitter) -> S
fn reduce(self: Splitter, f: ReduceFn) -> Option
fn skip(self: Splitter, n: i64) -> SkipIter<Splitter, &[u8]>
fn skip_while(self: Splitter, pred: fn(&[u8]) -> bool, zero: &[u8]) -> SkipWhileIter<Splitter, &[u8]>
fn step_by(self: Splitter, step: i64, zero: &[u8]) -> StepByIter<Splitter, &[u8]>
fn sum(self: Splitter) -> S
fn take(self: Splitter, n: i64) -> TakeIter<Splitter, &[u8]>
fn take_while(self: Splitter, pred: fn(&[u8]) -> bool, zero: &[u8]) -> TakeWhileIter<Splitter, &[u8]>
fn try_fold(self: Splitter, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: Splitter, f: TryEachFn) -> ControlFlow
fn zip(self: Splitter, other: ZipOther) -> ZipIter<Splitter, ZipOther, &[u8], ZipOtherItem>

structStrMatchIndex

struct StrMatchIndex

A byte-offset + matched-slice pair yielded by MatchIndices.

Fields

idx: i64

Byte offset of the match within the haystack.

m: &[u8]

The matched slice.

structUtf8Chunk

struct Utf8Chunk

A chunk from Utf8Chunks: a maximal valid prefix plus a trailing run of invalid bytes.

Fields

invalid_bytes: i64

Number of invalid bytes following valid; 0 when the input ends after valid.

valid: &[u8]

The well-formed UTF-8 slice (possibly empty).

structUtf8Chunks

struct Utf8Chunks

Iterator over runs of valid UTF-8 interleaved with invalid bytes; mirrors Rust’s Utf8Chunks.

Implements: Iterator

Fields

len: i64
pos: i64
ptr: *const u8

Methods

fn all(self: Utf8Chunks, pred: AllFn) -> bool
fn any(self: Utf8Chunks, pred: AnyFn) -> bool
fn chain(self: Utf8Chunks, other: ChainOther) -> ChainIter<Utf8Chunks, ChainOther, Utf8Chunk>
fn collect(self: Utf8Chunks) -> C
fn count(self: Utf8Chunks) -> i64
fn enumerate(self: Utf8Chunks) -> EnumIter<Utf8Chunks, Utf8Chunk>
fn filter(self: Utf8Chunks, pred: fn(Utf8Chunk) -> bool) -> FilterIter<Utf8Chunks, Utf8Chunk>
fn find(self: &mut Utf8Chunks, pred: FindFn) -> Option
fn find_map(self: Utf8Chunks, f: FindMapFn) -> Option
fn fold(self: Utf8Chunks, init: Acc, f: FoldFn) -> Acc
fn for_each(self: Utf8Chunks, f: EachFn) -> void
fn inspect(self: Utf8Chunks, visit: fn(Utf8Chunk) -> void, zero: Utf8Chunk) -> InspectIter<Utf8Chunks, Utf8Chunk>
fn last(self: Utf8Chunks) -> Option
fn map(self: Utf8Chunks, f: MapFn) -> MapIter<Utf8Chunks, Utf8Chunk, MapOut, MapFn>
fn max_by(self: Utf8Chunks, cmp: fn(Utf8Chunk, Utf8Chunk) -> i32) -> Option
fn min_by(self: Utf8Chunks, cmp: fn(Utf8Chunk, Utf8Chunk) -> i32) -> Option
fn next(self: &mut Utf8Chunks) -> Option
fn nth(self: &mut Utf8Chunks, n: i64) -> Option
fn peekable(self: Utf8Chunks) -> PeekableIter<Utf8Chunks, Utf8Chunk>
fn position(self: &mut Utf8Chunks, pred: PosFn) -> Option
fn product(self: Utf8Chunks) -> S
fn reduce(self: Utf8Chunks, f: ReduceFn) -> Option
fn skip(self: Utf8Chunks, n: i64) -> SkipIter<Utf8Chunks, Utf8Chunk>
fn skip_while(self: Utf8Chunks, pred: fn(Utf8Chunk) -> bool, zero: Utf8Chunk) -> SkipWhileIter<Utf8Chunks, Utf8Chunk>
fn step_by(self: Utf8Chunks, step: i64, zero: Utf8Chunk) -> StepByIter<Utf8Chunks, Utf8Chunk>
fn sum(self: Utf8Chunks) -> S
fn take(self: Utf8Chunks, n: i64) -> TakeIter<Utf8Chunks, Utf8Chunk>
fn take_while(self: Utf8Chunks, pred: fn(Utf8Chunk) -> bool, zero: Utf8Chunk) -> TakeWhileIter<Utf8Chunks, Utf8Chunk>
fn try_fold(self: Utf8Chunks, init: Acc, f: TryFoldFn) -> ControlFlow
fn try_for_each(self: Utf8Chunks, f: TryEachFn) -> ControlFlow
fn zip(self: Utf8Chunks, other: ZipOther) -> ZipIter<Utf8Chunks, ZipOther, Utf8Chunk, ZipOtherItem>

structUtf8Error

struct Utf8Error

Describes where a UTF-8 byte stream failed validation; returned by utf8_validate.

Fields

error_len: i64

Length of the invalid sequence (1..=4), or -1 for a truncated sequence at the tail.

valid_up_to: i64

Number of bytes that were valid before the error.

Functions

fnbool_from_str

fn bool_from_str(s: &[u8]) -> Result

Parses exactly "true" or "false"; any other input yields Err(ParseBoolError).

fnbytes_arr_eq

fn bytes_arr_eq(a: [u8; 0], b: [u8; 0]) -> bool

Returns true iff the two arrays are byte-for-byte equal.

fnchar_count

fn char_count(ptr: *const u8, len: i64) -> i64

Counts the codepoints in ptr[0..len] — exactly the number of items Chars yields. Steps by lead-byte declared length without validating; a truncated tail counts one per byte.

fnchars_from_raw

fn chars_from_raw(ptr: *const u8, len: i64) -> Chars

Creates a Chars iterator over the raw byte range ptr[0..len]. The buffer must stay valid for the iterator’s lifetime.

fndecode

fn decode(ptr: *const u8) -> u32

Decodes the codepoint at ptr[0..], returning U+FFFD for any invalid sequence. No bounds check — caller must ensure the full length declared by the lead byte is readable.

fnencode

fn encode(cp: u32, buf: *mut u8) -> i64

Encodes cp as UTF-8 into buf, returning the number of bytes written (1..=4). Surrogate or out-of-range cp writes U+FFFD instead (3 bytes written and returned). buf must have at least 4 writable bytes.

fnencode_len

fn encode_len(cp: u32) -> i64

Returns the number of bytes needed to encode cp in UTF-8 (1..=4), or 0 if cp > U+10FFFF. Surrogates report 3, matching encode, which emits U+FFFD (3 bytes) for them.

fnis_valid

fn is_valid(ptr: *const u8, len: i64) -> bool

Returns true iff ptr[0..len] is well-formed UTF-8 (rejects overlongs and surrogates).

fnmem_copy

fn mem_copy(dst: *mut u8, dst_off: i64, src: *const u8, n: i64) -> void

Copies n bytes from src into dst starting at byte offset dst_off. Forward byte-by-byte copy; overlapping regions are not supported (memcpy, not memmove).

fnseq_len

fn seq_len(b: u8) -> i64

Returns the length of the UTF-8 sequence whose lead byte is b (1..=4). Stray continuation bytes yield 1 (caller skips one byte).

fnsplit

fn split(s: &[u8], sep: &[u8]) -> Splitter

Splits s on each occurrence of sep, yielding sub-str views into s.

Empty sep yields the whole s once.

fnsplit_byte

fn split_byte(s: &[u8], sep: u8) -> ByteSplitter

Splits s on each occurrence of the single byte sep, yielding sub-str views into s.

fnstr_byte_at

fn str_byte_at(s: &[u8], i: i64) -> u8

Returns the i-th UTF-8 byte of s, or 0 if i is out of range. Safe wrapper over the raw index so byte scans need no unsafe at call sites.

fnstr_bytes

fn str_bytes(s: &[u8]) -> Bytes

Returns an iterator over the raw bytes of s.

fnstr_char_indices

fn str_char_indices(s: &[u8]) -> CharIndices

Returns an iterator over the codepoints of s and their byte offsets.

fnstr_chars

fn str_chars(s: &[u8]) -> Chars

Returns an iterator over the codepoints of s.

fnstr_cmp

fn str_cmp(a: &[u8], b: &[u8]) -> i32

Compares a and b lexicographically by bytes; returns -1, 0, or 1.

fnstr_contains

fn str_contains(s: &[u8], needle: &[u8]) -> bool

Returns true if needle occurs in s as a byte substring.

fnstr_contains_pat

fn str_contains_pat(s: &[u8], pat: P) -> bool

Returns true if pat matches anywhere in s.

fnstr_ends_with

fn str_ends_with(s: &[u8], suffix: &[u8]) -> bool

Returns true if s ends with the byte sequence suffix.

fnstr_eq

fn str_eq(a: &[u8], b: &[u8]) -> bool

Returns true iff a and b have the same length and byte content.

fnstr_find_pat

fn str_find_pat(s: &[u8], pat: P) -> i64

Returns the byte offset of the first match of pat in s, or -1 if none.

fnstr_from_cstr

fn str_from_cstr(ptr: *const u8) -> &[u8]

Constructs a str from a null-terminated C string (length via str_len). Safety: ptr must be a valid, non-null, null-terminated byte string.

fnstr_from_raw

fn str_from_raw(ptr: *const u8, len: i64) -> &[u8]

Constructs a str fat pointer from a raw pointer and explicit byte count. Compiler intrinsic — sema intercepts all call sites by name; the body is never called. Analogous to Rust’s std::slice::from_raw_parts::<u8>. Safety: ptr must be valid for len bytes and remain alive for the str lifetime.

fnstr_index_of

fn str_index_of(s: &[u8], needle: &[u8]) -> i64

Returns the byte offset of the first occurrence of needle in s, or -1 if not found. Empty needle returns 0. Naive search.

fnstr_len

fn str_len(s: *const u8) -> i64

Returns the byte length of a null-terminated C string, excluding the terminator.

fnstr_lines

fn str_lines(s: &[u8]) -> Lines

Returns an iterator over the lines of s, without terminators.

fnstr_match_indices

fn str_match_indices(s: &[u8], p: P) -> MatchIndices<P>

Returns an iterator over the matches of p in s and their byte offsets.

fnstr_matches

fn str_matches(s: &[u8], p: P) -> Matches<P>

Returns an iterator over the non-overlapping matches of p in s.

fnstr_split_pat

fn str_split_pat(s: &[u8], p: P) -> SplitPat<P>

Splits s on each match of pattern p, yielding sub-str views into s.

fnstr_starts_with

fn str_starts_with(s: &[u8], prefix: &[u8]) -> bool

Returns true if s begins with the byte sequence prefix.

fnstr_starts_with_pat

fn str_starts_with_pat(s: &[u8], pat: P) -> bool

Returns true if pat matches at the start of s.

fnstr_trim

fn str_trim(s: &[u8]) -> &[u8]

Trims leading and trailing ASCII whitespace, returning a sub-str of s.

fnstr_trim_end

fn str_trim_end(s: &[u8]) -> &[u8]

Trims trailing ASCII whitespace, returning a sub-str of s.

fnstr_trim_start

fn str_trim_start(s: &[u8]) -> &[u8]

Trims leading ASCII whitespace, returning a sub-str of s.

fnstr_utf8_chunks

fn str_utf8_chunks(s: &[u8]) -> Utf8Chunks

Returns a Utf8Chunks iterator over the bytes of s.

fnutf8_chunks_from_raw

fn utf8_chunks_from_raw(ptr: *const u8, len: i64) -> Utf8Chunks

Creates a Utf8Chunks iterator over the raw byte range ptr[0..len].

fnutf8_error_len

fn utf8_error_len(e: Utf8Error) -> Option

Returns the invalid-sequence length, or None for a truncated tail (Rust error_len).

fnutf8_error_valid_up_to

fn utf8_error_valid_up_to(e: Utf8Error) -> i64

Returns the number of valid bytes preceding the error.

fnutf8_validate

fn utf8_validate(ptr: *const u8, len: i64) -> Result

Validates that ptr[0..len] is well-formed UTF-8. On failure returns Utf8Error where error_len counts the bad bytes (1..=4), or is -1 for a sequence truncated at the end of input.

fnwrite_bool

fn write_bool(buf: *mut u8, off: i64, v: bool) -> i64

Writes "true" or "false" into buf[off..]; returns bytes written (4 or 5).

fnwrite_i32

fn write_i32(buf: *mut u8, off: i64, n: i32) -> i64

Writes the decimal representation of n into buf[off..]; returns bytes written.

fnwrite_i64

fn write_i64(buf: *mut u8, off: i64, n: i64) -> i64

Writes the decimal representation of n into buf[off..]; returns bytes written.

fnwrite_u64

fn write_u64(buf: *mut u8, off: i64, n: u64) -> i64

Writes the decimal representation of n into buf[off..]; returns bytes written.