Skip to content

Commit 3f687a9

Browse files
committed
chore: words
Signed-off-by: tison <[email protected]>
1 parent fc9d659 commit 3f687a9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

slate.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ export default defineConfig({
1818
icon: 'github',
1919
link: 'https://github.com/fast'
2020
},
21-
]
21+
]
2222
});

src/content/post/stacksafe-taming-recursion-in-rust-without-stack-overflow.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ drop(deep_tree); // No stack overflow
199199

200200
### Debug-Time Safety Checks
201201

202-
`StackSafe<T>` exposes the wrapped value through Rust's `Deref` trait, allowing transparent access to the underlying data. However, it includes an important safety mechanism: in debug builds, it checks whether the current function is properly annotated with `#[stacksafe]` whenever you access the wrapped value.
202+
`StackSafe<T>` exposes the wrapped value through Rust's `Deref` trait, allowing transparent access to the underlying data. What's more, it includes an important safety mechanism: in debug builds, it checks whether the current function is properly annotated with `#[stacksafe]` whenever you access the wrapped value.
203203

204204
```rust
205205
fn unsafe_tree_sum(tree: &BinaryTree) -> i32 {
@@ -226,13 +226,14 @@ fn safe_tree_sum(tree: &BinaryTree) -> i32 {
226226
}
227227
```
228228

229-
This debug-time checking helps you identify all potential stack overflow locations during development, rather than discovering them in production when they cause crashes.
229+
This debug-time check helps you identify all potential stack overflow locations during development, rather than discovering them in production when they cause crashes.
230230

231231
### Adopting `StackSafe` in Existing Code
232232

233233
Converting existing recursive code is straightforward. Here's a real-world example:
234234

235235
**Before** (crash-prone):
236+
236237
```rust
237238
#[derive(Debug, Clone)]
238239
pub enum JsonValue {
@@ -260,6 +261,7 @@ fn stringify(value: &JsonValue) -> String {
260261
```
261262

262263
**After** (stack-safe):
264+
263265
```rust
264266
use stacksafe::{stacksafe, StackSafe};
265267

@@ -301,5 +303,5 @@ The changes are minimal, but the result is a completely stack-safe JSON processo
301303
## Resources
302304

303305
- Crate: https://crates.io/crates/stacksafe
304-
- Documents: https://docs.rs/stacksafe/
306+
- Documents: https://docs.rs/stacksafe
305307
- GitHub: https://github.com/fast/stacksafe

0 commit comments

Comments
 (0)