pub trait Intersect<C, T>: Coordinates<C, T> + Overlap<C, T>where
C: ChromBounds,
T: ValueBounds,{
// Provided methods
fn build_intersection_interval<I: Coordinates<C, T>>(&self, other: &I) -> I { ... }
fn intersect<I: Coordinates<C, T>>(&self, other: &I) -> Option<I> { ... }
fn stranded_intersect<I: Coordinates<C, T>>(&self, other: &I) -> Option<I> { ... }
}Expand description
Calculates the intersection between two coordinates.
Provided Methods§
fn build_intersection_interval<I: Coordinates<C, T>>(&self, other: &I) -> I
Sourcefn intersect<I: Coordinates<C, T>>(&self, other: &I) -> Option<I>
fn intersect<I: Coordinates<C, T>>(&self, other: &I) -> Option<I>
Calculates the intersection between two coordinates if they overlap.
use bedrs::{Coordinates, Intersect, BaseInterval};
let a = BaseInterval::new(10, 20);
let b = BaseInterval::new(15, 25);
let ix = a.intersect(&b).unwrap();
assert_eq!(ix.start(), 15);
assert_eq!(ix.end(), 20);Sourcefn stranded_intersect<I: Coordinates<C, T>>(&self, other: &I) -> Option<I>
fn stranded_intersect<I: Coordinates<C, T>>(&self, other: &I) -> Option<I>
Calculates the intersection between two coordinates if they overlap and are on the same strand.
use bedrs::{Coordinates, Intersect, StrandedBed3, Strand};
let a = StrandedBed3::new(1, 10, 20, Strand::Forward);
let b = StrandedBed3::new(1, 15, 25, Strand::Forward);
let c = StrandedBed3::new(1, 15, 25, Strand::Reverse);
let ix = a.stranded_intersect(&b).unwrap();
assert_eq!(ix.start(), 15);
assert_eq!(ix.end(), 20);
assert_eq!(ix.strand(), Some(Strand::Forward));
assert!(a.stranded_intersect(&c).is_none());Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.