jonhoo / stream-cancel

A Rust library for interrupting asynchronous streams.
Apache License 2.0
156 stars 8 forks source link

Add sync to Tripwire #13

Closed bbqsrc closed 3 years ago

bbqsrc commented 3 years ago

Re-adds Sync to Tripwire and friends.

jonhoo commented 3 years ago

Great, thank you! Can you also add a static test to make sure it remains Sync in the future?

Something like:

#[test]
fn is_send_sync() {
    fn check<T: Send + Sync>(_: Option<T>) {}
    check::<Tripwire>(None);
}
bbqsrc commented 3 years ago

For static assertions I tend to use the lightweight static_assertions crate. Committed with that for now, but if you do not want this dependency, I can revert it and create the precise test you suggested, I just find that the assert macro mechanism is more thorough and declares the contract more obviously in the code.

codecov-commenter commented 3 years ago

Codecov Report

Merging #13 (e5371e4) into master (979300b) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #13   +/-   ##
=======================================
  Coverage   81.21%   81.21%           
=======================================
  Files           3        3           
  Lines         165      165           
=======================================
  Hits          134      134           
  Misses         31       31           
Impacted Files Coverage Δ
src/combinator.rs 75.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 979300b...e5371e4. Read the comment docs.

jonhoo commented 3 years ago

As an aside, there's no need to force-push. I can always squash when I eventually merge, or we can do one final rebase at th eend. Force-pushes makes it much harder to see what changed over time, and are rendered horribly on GitHub :sweat_smile:

bbqsrc commented 3 years ago

The force push was because I rebased on master as a courtesy to make the final squash merge easier, haha.

jonhoo commented 3 years ago

Released in 0.8.1 :tada: