# `PascalString` β `std::string::String` parity table
Legend:
- **Match**:
- β
= full correspondence is possible (same semantics are achievable for a fixed-capacity string)
- π« = full correspondence is not possible (due to fixed capacity, lack of owned buffer, or fundamentally different safety model)
- **Implemented**:
- β
= exists
- π‘ = partial (some equivalent exists, but semantics/API differ)
- β = not implemented
Notes:
- `PascalString` is **fixed capacity**, so many `String` βinfallible growthβ methods cannot have true parity.
- For those, we prefer **non-panicking `try_*` APIs** plus **`*_truncated`** (returning remainder) and explicit panicking
**`*_expect_capacity`** variants.
| `as_bytes` | β
| `as_bytes` | `as_ref::<[u8]>()` | β
|
| `as_mut_str` | β
| `as_mut_str` | *(also `DerefMut<Target=str>` provides `&mut str`)* | β
|
| `as_mut_vec` | π« | β | *(would expose raw bytes and break UTFβ8 invariant unless heavily constrained / unsafe)* | β |
| `as_str` | β
| `as_str` | *(also `Deref<Target=str>`)* | β
|
| `capacity` | β
| `capacity` | `CAPACITY` const (via type parameter) | β
|
| `clear` | β
| `clear` | β | β
|
| `drain` | π« | β | *(could be emulated by copying into a new buffer; return type/lifetime makes parity awkward)* | β |
| `extend_from_within` | π« | β | *(could be provided as `try_extend_from_within` / `*_truncated` / `*_expect_capacity`)* | β |
| `from_raw_parts` | π« | β | `into_inner` (different) | β |
| `from_utf16` | π« | β | *(could be `try_from_utf16` β `Result<PascalString, TooLong/DecodeError>`)* | β |
| `from_utf16_lossy` | π« | β | *(could be `from_utf16_lossy_truncated` / `try_from_utf16_lossy`)* | β |
| `from_utf16be` | π« | β | β | β |
| `from_utf16be_lossy` | π« | β | β | β |
| `from_utf16le` | π« | β | β | β |
| `from_utf16le_lossy` | π« | β | β | β |
| `from_utf8` | π« | β | `TryFrom<&[u8]> for PascalString` (validates UTFβ8 + capacity) | π‘ |
| `from_utf8_lossy` | π« | β | `from_str_truncated` + caller-side `String::from_utf8_lossy` | β |
| `from_utf8_lossy_owned` | π« | β | β | β |
| `from_utf8_unchecked` | π« | β | *(not applicable without owned heap buffer; `PascalString` maintains UTFβ8 invariant by construction)* | β |
| `insert` | π« | β | `try_insert`, `insert_expect_capacity` | π‘ |
| `insert_str` | π« | β | `try_insert_str`, `insert_str_expect_capacity` | π‘ |
| `into_boxed_str` | π« | β | `to_string().into_boxed_str()` | β |
| `into_bytes` | π« | β | `as_bytes().to_vec()`; `into_inner()` (bytes+len) | π‘ |
| `into_chars` | π« | β | *(iterate chars via `chars()` on `&str`)* | β |
| `into_raw_parts` | π« | β | `into_inner` (len + inline array) | π‘ |
| `is_empty` | β
| `is_empty` | β | β
|
| `leak` | π« | β | β | β |
| `len` | β
| `len` | β | β
|
| `new` | β
| `new` | β | β
|
| `pop` | β
| `pop` | β | β
|
| `push` | π« | β | `try_push`, `push_expect_capacity`, `push_str_truncated` (for strings) | π‘ |
| `push_str` | π« | β | `try_push_str`, `push_str_truncated`, `push_str_expect_capacity` | π‘ |
| `remove` | β
| `remove` *(panicking on invalid idx/boundary like `String`)* | `try_remove` (non-panicking) | π‘ |
| `remove_matches` | π« | β | `remove_matches(&str)` *(in-place scan+compact; `retain` covers char-level filtering)* | π‘ |
| `replace_first` | π« | β | *(could be implemented on `&str` output; may need truncation APIs)* | β |
| `replace_last` | π« | β | β | β |
| `replace_range` | π« | β | `try_replace_range_bounds`, `try_replace_range_bounds_truncated`, `replace_range_bounds_expect_capacity` | π‘ |
| `reserve` | π« | β | *(no-op if within capacity; otherwise cannot)* | β |
| `reserve_exact` | π« | β | β | β |
| `retain` | β
| `retain` | β | β
|
| `shrink_to` | π« | β | *(no-op for fixed-capacity)* | β |
| `shrink_to_fit` | π« | β | *(no-op for fixed-capacity)* | β |
| `split_off` | π« | β | `split_off(at)` panicking + `try_split_off(at)` non-panicking | π‘ |
| `truncate` | β
| `truncate` *(requires char boundary, panics like `String` on invalid boundary)* | β | β
|
| `try_reserve` | π« | β | *(could return Ok if fits, Err otherwise; not present)* | β |
| `try_reserve_exact` | π« | β | β | β |
| `try_with_capacity` | π« | β | `new` (capacity is const), `try_from_str_const` (const ctx) | β |
| `with_capacity` | π« | β | `new` (capacity is const) | β |