Rust::com unsubscribe event FFI implementation#238
Rust::com unsubscribe event FFI implementation#238bharatGoswami8 wants to merge 2 commits intoeclipse-score:mainfrom
Conversation
bharatGoswami8
commented
Mar 25, 2026
- Unsubscribe event FFI implementation and runtime update
ab30d42 to
ade79ca
Compare
darkwisebear
left a comment
There was a problem hiding this comment.
Please add the requested test and reword the SAFETY comment to focus on the properties that are important for this block to be sound.
|
|
||
| fn unsubscribe(self) -> Self::Subscriber { | ||
| //SAFETY: it is safe to unsubscribe from event because event ptr is valid | ||
| //User must not call unsubscribe while holding any samplePtr or performing any receive operation, |
There was a problem hiding this comment.
That should be guaranteed by the compiler. If that were a safety hazard, the unsubscribe method had to be declared as unsafe (but I believe that this isn't necessary). Can you double-check this please and provide a doctest that fails to compile?
There was a problem hiding this comment.
The compiler generates an error when the unsubscribe API is called while SampleContainer still holds a SamplePtr. Added a doctest to demonstrate this failure and updated the safety comment accordingly.
c423210 to
92bfdc3
Compare
| handles: None, | ||
| }; | ||
| assert!(state.find_handle.is_none()); | ||
| let state = super::DiscoveryStateData { handles: None }; |
There was a problem hiding this comment.
this is just cleanup from last PR.
159482d to
d6776b4
Compare
* Unsubscribe event FFI implementation and runtime update
de293bc to
6506f3e
Compare
* Added rust doc test for sampleptr validation * Added unsunsctibe in drop call
6506f3e to
14d1cd9
Compare