fn cmpexons(bucket: Arc<DashMap<&String, Bucket>>) { bucket.pariter().foreach( (read,…
- User
fn cmp_exons(bucket: Arc<DashMap<&String, Bucket>>) { bucket.par_iter().for_each(|(read, exons)| { exons.read_exons.par_iter().for_each(|&(start, end)| { if let Some(index) = binary_search_gene_exons(&exons.gene_exons, start, end) { let (tx_start, tx_end) = exons.gene_exons[index]; println!( "Exon {:?} from read {:?} is within exon {:?} from transcript {:?}", start, read, tx_start, exons.id ); } else { println!( "Exon {:?} from read {:?} is not within any exon boundary from transcript {:?}", start, read, exons.id ); } }); }) }
error[E0308]: mismatched types --> src/main.rs:116:33 | 116 | bucket.par_iter().for_each(|(read, exons)| { | ^^^^^^^^^^^^^ | | | expected
RefMulti<'_, &String, Bucket>, found(_, _)| expected due to this | = note: expected structdashmap::mapref::multiple::RefMulti<'_, &String, Bucket>found tuple(_, _)For more information about this error, try
rustc --explain E0308. error: could not compiledeintronize(bin "deintronize") due to 1 previous error - Assistant
The error you're receiving is because the
par_itermethod for aDashMapreturns an iterator overRefMultiinstances, which wrap the references to the keys and values, but your closure is attempting to unpack those references as if they were just a tuple. You need to use 's methods to access the key and value. - User
fn cmp_exons(bucket: Arc<DashMap<&String, Bucket>>) { bucket.par_iter().for_each(|entry| { let read = entry.key(); let exons = entry.value(); exons.read_exons.par_iter().for_each(|&(start, end)| { if let Some(index) = binary_search_gene_exons(&exons.gene_exons, start, end) { let (tx_start, tx_end) = exons.gene_exons[index]; println!( "Exon {:?} from read {:?} is within exon {:?} from transcript {:?}", start, read, tx_start, exons.id ); } else { println!( "Exon {:?} from read {:?} is not within any exon boundary from transcript {:?}", start, read, exons.id ); } }); }) }
error[E0308]: arguments to this function are incorrect --> src/main.rs:120:34 | 120 | if let Some(index) = binary_search_gene_exons(&exons.gene_exons, start, end) { | ^^^^^^^^^^^^^^^^^^^^^^^^ ----- --- expected
usize, foundu32| | | expected , found | note: expected , found --> src/main.rs:120:59 | 120 | if let Some(index) = binary_search_gene_exons(&exons.gene_exons, start, end) { | ^^^^^^^^^^^^^^^^^ = note: expected reference found reference - Assistant
The error message indicates that the
binary_search_gene_exonsfunction is expecting aVec<(usize, usize)>, but it is being provided with a . The and variables which represent the exon positions are expected to be , but they are in your .