Skip to content

Commit 6a26782

Browse files
refactor(state): make Context::as_ptr internal using sealed trait
Replace public as_ptr method with sealed AsPtr trait implementation to restrict raw pointer access to internal crate usage only.
1 parent 05402db commit 6a26782

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/state/context.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use libbitcoinkernel_sys::{
1010
};
1111

1212
use crate::{
13-
ffi::c_helpers,
13+
ffi::{c_helpers, sealed::AsPtr},
1414
notifications::{
1515
notification::{
1616
notification_block_tip_wrapper, notification_fatal_error_wrapper,
@@ -87,9 +87,11 @@ impl Context {
8787
));
8888
}
8989
}
90+
}
9091

91-
pub fn as_ptr(&self) -> *mut btck_Context {
92-
self.inner
92+
impl AsPtr<btck_Context> for Context {
93+
fn as_ptr(&self) -> *const btck_Context {
94+
self.inner as *const _
9395
}
9496
}
9597

0 commit comments

Comments
 (0)