8000 docs: a decoded record points into its session's frame by plebhash · Pull Request #3 · stratum-mining/sv2-ffi · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The C header is generated by cbindgen from the Rust sources and committed, so a

## Memory and panics at the boundary

The C side owns every buffer and sees no Rust lifetime: an encoder writes into a caller buffer of a given capacity, a decoder reads a caller buffer and points its byte fields into it. The only Rust allocations a caller holds are the objects of `_new()` functions, released by their `_free()`. No panic crosses the boundary: every exported function catches it and reports an error code. Whenever adding or changing an exported function, keep these rules, and cover the error paths from C, under the sanitizers, not only from Rust.
The C side owns every buffer it passes and sees no Rust lifetime: an encoder writes into a caller buffer of a given capacity, and a decoded record points into the frame its session keeps, valid until that session's next decode or its free. The only Rust allocations a caller holds are the objects of `_new()` functions, released by their `_free()`. No panic crosses the boundary: every exported function catches it and reports an error code. Whenever adding or changing an exported function, keep these rules, and cover the error paths from C, under the sanitizers, not only from Rust.

## Code comments and attributes

Expand Down
Loading
0