Type Strpub

Implements: Add · Debug · Default · Display · Eq · Hash · Into · Into · Matcher · Ord · TryInto · TryInto
:type(pub) Str

Conversions

Conversions to

Implementations

impl Str

impl Str

.as-bytes ( Str Bytes )

.as-bytes — zero-copy-style view of the receiver's UTF-8 encoding. Runtime shape matches .bytes: a plain Bytes cell. The "zero-copy" guarantee is a forward-compatibility contract; today the implementation allocates a fresh Bytes over the byte view.

.byte-at ( Str (Int ..) (Option (Int 0..)) )

.byte-at — byte at index as (Option AnyUInt) (the byte value 0..256).

.bytes ( Str Bytes )

.bytes — return the UTF-8 encoding as a Bytes cell. Eager Bytes form; the spec's lazy (Iterator U8) form lives on the core Str type.

.char-at ( Str (Int ..) (Option Codepoint) )

.char-at — nth codepoint (0-indexed) as (Option Codepoint).

.char-count ( Str (Int ..) )

.char-count — count of Unicode codepoints (distinct from .len, which is the UTF-8 byte count).

.chars ( Str (Vec Codepoint) )

.chars — enumerate the Unicode codepoints of the receiver into a (Vec Codepoint). Eager Vec complement of the spec's lazy .codepoints iterator.

.contains ( Str m Bool )

.containstrue iff m matches anywhere in the receiver. Accepts any (CodepointMatcher m); delegates to .find and projects presence.

.ends-with ( Str Str Bool )

.ends-with — true iff the receiver ends with the suffix.

.find ( Str m (Option (Int ..)) )

.find — byte offset of the first occurrence of m in the receiver, or None if m does not match. Accepts any (CodepointMatcher m): the built-in Str, Codepoint, (Vec Codepoint), or a predicate quotation. Delegates to .find-in and projects the start offset.

.is-ascii ( Str Bool )

.is-ascii — true iff every byte is < 128.

.is-empty ( Str Bool )

.is-empty — true iff the byte length is zero.

.join ( Str (Vec Str) Str )

.join — insert separator between vector elements and concatenate.

.lines ( Str (Vec Str) )

.lines — split by newline (\n, \r\n, \r); trailing newline does not emit an extra empty element.

.pad-left ( Str (Int ..) Codepoint Str )

.pad-left — left-pad with fill until .codepoints .count >= width.

.pad-right ( Str (Int ..) Codepoint Str )

.pad-right — right-pad with fill until codepoint-count >= width.

.repeat ( Str (Int ..) Str )

.repeat — concatenate the receiver N times (0 or negative yields "").

.replace ( Str Str Str Str )

.replace — replace first occurrence of target with replacement.

.replace-all ( Str Str Str Str )

.replace-all — replace every non-overlapping occurrence.

.rfind ( Str Str (Int ..) )

.rfind — byte offset of the last occurrence, or -1 if not found. Still takes a literal Str pending a backward-scanning Matcher variant.

.split ( Str Str (Vec Str) )

.split — split by a Str separator into a (Vec Str). Mirrors the core split word with .method dispatch.

.split-once ( Str Str (Option (Pair Str Str)) )

.split-once — split at the first occurrence of a Str separator, returning Some (Pair left right) (separator excluded) or None when the separator is absent. This is the literal-Str form; the full spec signature uses a Matcher constraint, which is deferred until Matcher trait rewiring lands.

.split-whitespace ( Str (Vec Str) )

.split-whitespace — split on runs of Unicode whitespace, dropping empties. Equivalent in content to .words; returned eagerly as a (Vec Str) pending a lazy iterator surface for Str sources.

.starts-with ( Str Str Bool )

.starts-with — true iff the receiver starts with the prefix.

.strip-prefix ( Str Str (Option Str) )

.strip-prefix — remove the prefix if present; Some rest or None.

.strip-suffix ( Str Str (Option Str) )

.strip-suffix — remove the suffix if present; Some rest or None.

.to-ascii-lower ( Str Str )

.to-ascii-lower — ASCII-only lowercase; non-ASCII bytes pass through.

.to-ascii-upper ( Str Str )

.to-ascii-upper — ASCII-only uppercase; non-ASCII bytes pass through.

.to-lower ( Str Str )

.to-lower — Unicode lowercase (via Rust std).

.to-upper ( Str Str )

.to-upper — Unicode uppercase (via Rust std).

.to-utf16 ( Str (Vec (Int 0..)) )

.to-utf16 — encode as UTF-16 code units. Returns (Vec AnyUInt) — each element is a UTF-16 code unit in the range 0..65536. The concrete U16 alias is not used in the signature because alias normalisation during signature registration conflicts with the intrinsic's existential bound on the element type.

.trim ( Str Str )

.trim — trim Unicode White_Space from both ends.

.trim-end ( Str Str )

.trim-end — trim Unicode White_Space from the end only.

.trim-start ( Str Str )

.trim-start — trim Unicode White_Space from the start only.

.words ( Str (Vec Str) )

.words — split on Unicode whitespace, dropping empties.

Trait Implementations

impl Add Str for Str | Str

.+ ( Str Str Str )

.zero ( Str )

impl Debug for Str

.fmt-debug ( Str Str )

impl Default for Str

.default ( Str )

impl Display for Str

.fmt ( Str Str )

impl Eq Str for Str

.= ( Str Str Bool )

.≠ ( Str Str Bool )

impl Hash for Str

.hash ( Str (Int ..) )

impl Into Str for Str

.from ( Str Str )

impl Into Str for Str

.into ( Str Str )

impl Matcher Str Codepoint for Str

Str is a matcher that matches itself byte-identically inside another Str. .find-in delegates to the host str-find intrinsic and shapes the byte offset into Some (RangeBoth start end) or None. .find-all-in walks the input with successive slices.

.find-all-in ( Str Str (Vec (Range (Int ..))) )

.find-in ( Str Str (Option (Range (Int ..))) )

impl Ord Str for Str

.< ( Str Str Bool )

.> ( Str Str Bool )

.≤ ( Str Str Bool )

.≥ ( Str Str Bool )

impl TryInto Locale for Str | Str

.try-from ( Str (Result Locale Str) )

impl TryInto Locale for Str | Str

.try-into ( Str (Result Locale Str) )