pub struct Span {
pub start: Rational,
pub end: Rational,
}Expand description
A rational range over a single dimension, represented with a start and end.
Fields§
§start: Rational§end: RationalImplementations§
Source§impl Span
impl Span
pub fn new(start: Rational, end: Rational) -> Self
pub fn instant(start: Rational) -> Self
pub fn len(&self) -> Rational
pub fn cycles(self) -> impl Iterator<Item = Self>
pub fn map(self, f: impl Fn(Rational) -> Rational) -> Self
pub fn map_len(self, f: impl Fn(Rational) -> Rational) -> Self
Sourcepub fn contains(&self, point: Rational) -> bool
pub fn contains(&self, point: Rational) -> bool
Checks if point lies within the span exclusively.
Sourcepub fn intersect(self, other: Self) -> Option<Self>
pub fn intersect(self, other: Self) -> Option<Self>
The intersecting span between self and other.
NOTE: If either span’s start is equal to its end, None is returned.
Sourcepub fn difference(self, other: Self) -> (Option<Self>, Option<Self>)
pub fn difference(self, other: Self) -> (Option<Self>, Option<Self>)
The portions of other that do not intersect self.
Returns preceding and succeeding diffs respectively.
Returns (None, None) in the case that other is a subsection of self.
Trait Implementations§
Source§impl Ord for Span
impl Ord for Span
Source§impl PartialOrd for Span
impl PartialOrd for Span
impl Copy for Span
impl Eq for Span
impl StructuralPartialEq for Span
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnwindSafe for Span
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more