NativeStringView
Borrows immutable native process text units without retaining their owner. Native units preserve native values independently of Unicode validity. Construction rejects NUL and adds no normalization, separator rewriting, allocation or cwd lookup. Views expire with backing mutation/move/destruction. Copying a view does not retain backing. Concurrent access needs the backing owner's contract. TryToString allocates explicitly; TryViewUtf8 validates a borrowed byte view.
Module std.text
import std.text;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
NativeStringView
pub final class NativeStringViewBorrows immutable native process text units without retaining their owner. Native units preserve native values independently of Unicode validity. Construction rejects NUL and adds no normalization, separator rewriting, allocation or cwd lookup. Views expire with backing mutation/move/destruction. Copying a view does not retain backing. Concurrent access needs the backing owner's contract. TryToString allocates explicitly; TryViewUtf8 validates a borrowed byte view.
NativeStringView.init
pub init()Creates valid empty byte view without allocation.
NativeStringView.Encoding
pub Encoding: NativeStringEncoding;Observes exact active native unit kind.
NativeStringView.UnitLength
pub UnitLength: usize;Counts active native units, not Unicode scalars or UTF-16 bytes.
NativeStringView.IsEmpty
pub IsEmpty: bool;Observes an empty native representation.
NativeStringView.NativeBytes
pub NativeBytes: readonly byte[]?;Borrows exact byte units when active; none for UTF-16.
NativeStringView.NativeUtf16
pub NativeUtf16: readonly u16[]?;Borrows exact UTF-16 units when active; none for bytes.
NativeStringView.TryFromNativeBytes
pub static fn TryFromNativeBytes(Units: readonly byte[]) -> Result<NativeStringView, NativeStringError>Validates NUL-free native bytes without Unicode conversion/allocation. Units: Borrowed exact bytes; caller retains backing. Return: View or EmbeddedNul.
NativeStringView.TryFromNativeUtf16
pub static fn TryFromNativeUtf16(Units: readonly u16[]) -> Result<NativeStringView, NativeStringError>Validates NUL-free native UTF-16 without rejecting unpaired surrogates. Units: Borrowed exact units; caller retains backing. Return: View or EmbeddedNul.
NativeStringView.TryViewUtf8
pub readonly fn TryViewUtf8() -> str?Validates a borrowed UTF-8 view of active native bytes. Return: Borrowed text, or none for invalid UTF-8/UTF-16 representation. Warning: Does not allocate or retain backing.
NativeStringView.TryToString
pub readonly fn TryToString() -> Result<String, NativeStringError>Converts native units into owned UTF-8 text without changing the native string. Return: Owned String or exact Unicode/storage failure. Warning: May allocate; unpaired native UTF-16 remains preserved on failure.
NativeStringView.EqualsOrdinal
pub readonly fn EqualsOrdinal(Other: NativeStringView) -> boolCompares exact native units without Unicode or locale conversion. Other: Borrowed representation, retained only through this call. Return: Equal unit kind and contents; different representations are unequal. Linear in unit length, allocation-free and safe for immutable concurrent use.