From 3501eb360fef484e132897b925f7235d7bba3b69 Mon Sep 17 00:00:00 2001 From: andylokandy Date: Sun, 8 Jun 2025 16:02:41 +0800 Subject: [PATCH 1/2] chore: improve doc --- stacksafe/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/stacksafe/src/lib.rs b/stacksafe/src/lib.rs index fed62fd..20d22af 100644 --- a/stacksafe/src/lib.rs +++ b/stacksafe/src/lib.rs @@ -158,11 +158,12 @@ pub use stacksafe_macro::stacksafe; static MINIMUM_STACK_SIZE: AtomicUsize = AtomicUsize::new(128 * 1024); static STACK_ALLOC_SIZE: AtomicUsize = AtomicUsize::new(2 * 1024 * 1024); -/// Configures the minimum stack space threshold for triggering stack allocation in bytes (default: -/// 128 KiB). +/// Configures the minimum stack space threshold for triggering stack allocation in bytes. /// /// When a function marked with [`#[stacksafe]`](stacksafe) is called and the remaining stack /// space is less than this threshold, a new stack segment will be allocated. +/// +/// Defaults to 128 KiB. pub fn set_minimum_stack_size(bytes: usize) { MINIMUM_STACK_SIZE.store(bytes, Ordering::Relaxed); } @@ -175,10 +176,12 @@ pub fn get_minimum_stack_size() -> usize { MINIMUM_STACK_SIZE.load(Ordering::Relaxed) } -/// Configures the size of newly allocated stack segments in bytes (default: 2 MiB). +/// Configures the size of newly allocated stack segments in bytes. /// /// When a function marked with [`#[stacksafe]`](stacksafe) needs more stack space, /// it allocates a new stack segment of this size. +/// +/// Defaults to 2 MiB. pub fn set_stack_allocation_size(bytes: usize) { STACK_ALLOC_SIZE.store(bytes, Ordering::Relaxed); } From df69763eccdf7120c42418a18fde2e573ad25838 Mon Sep 17 00:00:00 2001 From: andylokandy Date: Mon, 9 Jun 2025 14:07:54 +0800 Subject: [PATCH 2/2] fix --- stacksafe/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stacksafe/src/lib.rs b/stacksafe/src/lib.rs index 20d22af..378fb27 100644 --- a/stacksafe/src/lib.rs +++ b/stacksafe/src/lib.rs @@ -162,7 +162,7 @@ static STACK_ALLOC_SIZE: AtomicUsize = AtomicUsize::new(2 * 1024 * 1024); /// /// When a function marked with [`#[stacksafe]`](stacksafe) is called and the remaining stack /// space is less than this threshold, a new stack segment will be allocated. -/// +/// /// Defaults to 128 KiB. pub fn set_minimum_stack_size(bytes: usize) { MINIMUM_STACK_SIZE.store(bytes, Ordering::Relaxed); @@ -180,7 +180,7 @@ pub fn get_minimum_stack_size() -> usize { /// /// When a function marked with [`#[stacksafe]`](stacksafe) needs more stack space, /// it allocates a new stack segment of this size. -/// +/// /// Defaults to 2 MiB. pub fn set_stack_allocation_size(bytes: usize) { STACK_ALLOC_SIZE.store(bytes, Ordering::Relaxed);