smart-string 0.3.0

A collection of string types and traits designed for enhanced string manipulation.
Documentation
# `SmartString` ↔ `std::string::String` parity table

Legend:

- **Match**:
  - βœ… = full correspondence is possible (same semantics are achievable for a stack-or-heap string)
  - 🚫 = full correspondence is not possible (or would require exposing representation/unsafe contracts we intentionally avoid)
- **Implemented**:
  - βœ… = exists
  - 🟑 = partial (some equivalent exists, but semantics/API differ)
  - ❌ = not implemented

Notes:

- `SmartString` can promote from stack to heap, so most `String` APIs can have full semantic parity.
- Some APIs are **unsafe / representation-exposing** (`*_raw_parts`, `as_mut_vec`, `from_utf8_unchecked`). They are
  technically possible (by forcing heap) but are treated as β€œout of scope” for now; see the β€œAdditional/alternative”
  column.

| `String` method | Match | SmartString method (full match) | Additional / alternative methods | Implemented |
|---|---:|---|---|---:|
| `as_bytes` | βœ… | `as_bytes` | `as_ref::<[u8]>()` | βœ… |
| `as_mut_str` | βœ… | `as_mut_str` | *(also `DerefMut<Target=str>`)* | βœ… |
| `as_mut_vec` | βœ… | β€” | *(possible by forcing heap: `s.into_heap()` then `String::as_mut_vec` (unsafe))* | ❌ |
| `as_str` | βœ… | `as_str` | *(also `Deref<Target=str>`)* | βœ… |
| `capacity` | βœ… | `capacity` | β€” | βœ… |
| `clear` | βœ… | `clear` | β€” | βœ… |
| `drain` | βœ… | `drain` | *(currently promotes to heap and delegates)* | βœ… |
| `extend_from_within` | βœ… | `extend_from_within` | *(safe: extract range + push_str; promotes to heap on overflow)* | βœ… |
| `from_raw_parts` | 🚫 | β€” | *(representation-exposing/unsafe; could exist only for heap variant)* | ❌ |
| `from_utf16` | βœ… | `from_utf16` | β€” | βœ… |
| `from_utf16_lossy` | βœ… | `from_utf16_lossy` | β€” | βœ… |
| `from_utf16be` | βœ… | `from_utf16be` | *(manual UTF-16 BE decode from `&[u8]`; returns `Utf16DecodeError`)* | βœ… |
| `from_utf16be_lossy` | βœ… | `from_utf16be_lossy` | *(lossy variant, replaces invalid with U+FFFD)* | βœ… |
| `from_utf16le` | βœ… | `from_utf16le` | *(manual UTF-16 LE decode from `&[u8]`)* | βœ… |
| `from_utf16le_lossy` | βœ… | `from_utf16le_lossy` | *(lossy variant)* | βœ… |
| `from_utf8` | βœ… | `from_utf8` | β€” | βœ… |
| `from_utf8_lossy` | βœ… | `from_utf8_lossy` | β€” | βœ… |
| `from_utf8_lossy_owned` | βœ… | `from_utf8_lossy_owned` | β€” | βœ… |
| `from_utf8_unchecked` | βœ… | β€” | *(possible by forcing heap and delegating; unsafe API)* | ❌ |
| `insert` | βœ… | `insert` | `insert_str_truncated` (SmartString-only helper for stack paths) | βœ… |
| `insert_str` | βœ… | `insert_str` | `insert_str_truncated`, `try_insert_str_truncated` | βœ… |
| `into_boxed_str` | βœ… | `into_boxed_str` | β€” | βœ… |
| `into_bytes` | βœ… | `into_bytes` | `From<SmartString> for Vec<u8>` | βœ… |
| `into_chars` | βœ… | `into_chars` | *(custom `IntoChars<N>` with full trait surface; no `IntoIterator` trait until std stabilizes it)* | βœ… |
| `into_raw_parts` | 🚫 | β€” | *(representation-exposing/unsafe; could exist only for heap variant)* | ❌ |
| `is_empty` | βœ… | `is_empty` | β€” | βœ… |
| `leak` | βœ… | `leak` | β€” | βœ… |
| `len` | βœ… | `len` | *(also `Deref<Target=str>`)* | βœ… |
| `new` | βœ… | `new` | β€” | βœ… |
| `pop` | βœ… | `pop` | β€” | βœ… |
| `push` | βœ… | `push` | β€” | βœ… |
| `push_str` | βœ… | `push_str` | β€” | βœ… |
| `remove` | βœ… | `remove` | β€” | βœ… |
| `remove_matches` | βœ… | `remove_matches` | *(accepts `&str`; also `remove_matches_char` for `char`)* | βœ… |
| `replace_first` | βœ… | `replace_first` | *(accepts `&str`; also `replace_first_char` for `char`; via `replace_range`)* | βœ… |
| `replace_last` | βœ… | `replace_last` | *(accepts `&str`; also `replace_last_char` for `char`; via `replace_range`)* | βœ… |
| `replace_range` | βœ… | `replace_range` | β€” | βœ… |
| `reserve` | βœ… | `reserve` | β€” | βœ… |
| `reserve_exact` | βœ… | `reserve_exact` | β€” | βœ… |
| `retain` | βœ… | `retain` | β€” | βœ… |
| `shrink_to` | βœ… | `shrink_to` | β€” | βœ… |
| `shrink_to_fit` | βœ… | `shrink_to_fit` | β€” | βœ… |
| `split_off` | βœ… | `split_off` | *(optimized to avoid allocation when tail fits stack)* | βœ… |
| `truncate` | βœ… | `truncate` | β€” | βœ… |
| `try_reserve` | βœ… | `try_reserve` | β€” | βœ… |
| `try_reserve_exact` | βœ… | `try_reserve_exact` | β€” | βœ… |
| `try_with_capacity` | βœ… | `try_with_capacity` | β€” | βœ… |
| `with_capacity` | βœ… | `with_capacity` | β€” | βœ… |