Skip to content

Commit 3e6aa61

Browse files
tamirmsclaude
andcommitted
xdr: clarify Raw() is zero-allocation (subslice, not copy)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5e16159 commit 3e6aa61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xdr/views_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ Views are designed to safely handle untrusted input. Here is what the implementa
246246

247247
**No panics on malformed input.** Every slice operation is preceded by a bounds check. All accessors return `(T, error)` — they never panic, even on truncated, corrupt, or adversarial data.
248248

249-
**No unbounded memory allocation.** View construction is a zero-cost type cast. Navigation allocates nothing on the heap. `Raw()` and `Copy()` allocate exactly the bytes needed.
249+
**No unbounded memory allocation.** View construction is a zero-cost type cast. Navigation allocates nothing on the heap. `Raw()` returns a subslice of the original buffer (zero allocation). `Copy()` allocates exactly the bytes needed.
250250

251251
**Recursion depth limits.** XDR allows recursive types (e.g., `ClaimPredicate`, `SCVal`). Two independent limits prevent stack overflow:
252252
- All internal traversal (field navigation, `Raw()`, etc.) enforces a limit of `MaxViewDepth()` nesting levels (default 10,000, configurable at init via `SetMaxViewDepth(n)`).

0 commit comments

Comments
 (0)