2.8 KiB
2.8 KiB
1.0.0-beta.20 String Search And ASCII Trim Foundation
Scope
1.0.0-beta.20 is a standard-library and compiler-gate slice. It does not
change source-language syntax, runtime C, compiler-known runtime names, or
ABI/layout policy.
The release adds source-authored std.string helpers:
contains ((value string) (needle string)) -> boolindex_of_option ((value string) (needle string)) -> (option i32)last_index_of_option ((value string) (needle string)) -> (option i32)trim_ascii_start ((value string)) -> stringtrim_ascii_end ((value string)) -> stringtrim_ascii ((value string)) -> string
Contract
Search is byte-oriented over the current runtime string representation.
index_of_option returns the first zero-based byte offset for a matching
needle, last_index_of_option returns the last zero-based byte offset, and
contains is true when index_of_option returns some.
Empty needles are valid:
index_of_option value ""returnssome 0last_index_of_option value ""returnssome (len value)contains value ""returnstrue
Missing needles return none.
ASCII trim removes only these byte values from the requested edges:
9horizontal tab10line feed11vertical tab12form feed13carriage return32space
The helpers compose over already-promoted string primitives:
std.string.lenstd.string.byte_at_resultstd.string.slice_resultstd.string.starts_withstd.string.ends_with
Non-Scope
This scope does not add:
- compiler-known
std.string.*runtime names for the new helpers - runtime C helper implementations
- source-language syntax
- Unicode scalar, grapheme, display-width, or normalization semantics
- case folding or locale-sensitive search
- regular expressions
- tokenizer/parser APIs
- mutable strings
- language slice/view syntax
- stable string ABI/layout
- stable allocation ownership rules
- stable standard-library compatibility
- performance claims
Acceptance Criteria
lib/std/string.sloexports all six helpers.- Explicit
std.stringimport examples exercise contains, first/last search, missing needles, empty needles, leading trim, trailing trim, full trim, all-whitespace trim, and no-trim cases. - Local
std-layout-local-stringexamples mirror the public helper surface. - Focused compiler coverage verifies the helpers are source-authored and that direct compiler-known runtime calls for the new names remain unsupported.
scripts/release-gate.shruns the focused beta20 test.- Generated standard-library API documentation includes the new signatures.
Gates
cargo fmt --check
cargo test --test standard_string_search_trim_beta20
cargo test --test standard_string_source_fallback_helpers_alpha
cargo test --test standard_string_scanning_beta16
cargo test
./scripts/release-gate.sh