You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move `NativeStr` from `fspy_shared::ipc::native_str` into a new
`native_str` crate with its own README. The type is re-exported from
`fspy_shared::ipc` so downstream crates are unaffected.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
A platform-native string type for lossless, zero-copy IPC.
4
+
5
+
`NativeStr` is a `#[repr(transparent)]` newtype over `[u8]` that represents OS strings in their native encoding:
6
+
7
+
-**Unix**: raw bytes (same as `OsStr`)
8
+
-**Windows**: raw wide character bytes (from `&[u16]`, stored as `&[u8]` for uniform handling)
9
+
10
+
## Why not `OsStr`?
11
+
12
+
`OsStr` requires valid UTF-8 for serialization. `NativeStr` can be serialized/deserialized losslessly regardless of encoding, with zero-copy support via wincode's `SchemaRead`.
13
+
14
+
## Limitations
15
+
16
+
**Not portable across platforms.** The binary representation of a `NativeStr` is platform-specific — Unix uses raw bytes while Windows uses wide character pairs. Deserializing a `NativeStr` that was serialized on a different platform leads to unspecified behavior (garbage data), but is not unsafe.
17
+
18
+
This type is designed for same-platform IPC (e.g., shared memory between a parent process and its children), not for cross-platform data exchange or persistent storage. For portable paths, use UTF-8 strings instead.
0 commit comments