Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Send + Sync on key structs? #104

Open
nh13 opened this issue Jul 20, 2022 · 1 comment
Open

Implement Send + Sync on key structs? #104

nh13 opened this issue Jul 20, 2022 · 1 comment

Comments

@nh13
Copy link
Contributor

nh13 commented Jul 20, 2022

I wanted to use rayon to parallelize some of my processing, but found that I need to have the Send + Sync traits for key structs, like a Bed record and BAM record. Is there any appetite for adding those, and/or figuring out which are safe to send and share across threads?

 bed_reader.records::<6>().par_bridge()
@zaeleus
Copy link
Owner

zaeleus commented Jul 20, 2022

The data containers are Send + Sync. See the auto trait implementations for sam::alignment::Record and bed::Record<N>.

Looking at ParallelBridge, the iterator is also required to be Send. This is not possible for bed::Reader::records<N> because it captures Self<R> as a mutable reference. You can, however, move the reader into your own iterator to create a producer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants