Skip to content

Rust::com unsubscribe event FFI implementation#238

Open
bharatGoswami8 wants to merge 2 commits intoeclipse-score:mainfrom
bharatGoswami8:unsubscribe_FFI_impl
Open

Rust::com unsubscribe event FFI implementation#238
bharatGoswami8 wants to merge 2 commits intoeclipse-score:mainfrom
bharatGoswami8:unsubscribe_FFI_impl

Conversation

@bharatGoswami8
Copy link
Contributor

  • Unsubscribe event FFI implementation and runtime update

Copy link
Contributor

@darkwisebear darkwisebear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bharatGoswami8 bharatGoswami8 force-pushed the unsubscribe_FFI_impl branch 6 times, most recently from c423210 to 92bfdc3 Compare March 26, 2026 04:52
handles: None,
};
assert!(state.find_handle.is_none());
let state = super::DiscoveryStateData { handles: None };
Copy link
Contributor Author

@bharatGoswami8 bharatGoswami8 Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just cleanup from last PR.

@bharatGoswami8 bharatGoswami8 force-pushed the unsubscribe_FFI_impl branch 3 times, most recently from 159482d to d6776b4 Compare March 26, 2026 08:18
* Unsubscribe event FFI implementation and runtime update
@bharatGoswami8 bharatGoswami8 force-pushed the unsubscribe_FFI_impl branch 2 times, most recently from de293bc to 6506f3e Compare March 26, 2026 09:07
* Added rust doc test for sampleptr validation
* Added unsunsctibe in drop call
@LittleHuba LittleHuba added this pull request to the merge queue Mar 27, 2026
@LittleHuba LittleHuba removed this pull request from the merge queue due to a manual request Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants