Skip to main content

TimespanTree

Struct TimespanTree 

Source
pub struct TimespanTree<'a> { /* private fields */ }
Expand description

The timespans of a stream in time, each answer in music21’s order: by where they start, then where they end, then as the stream holds them: music21’s TimespanTree.

Implementations§

Source§

impl<'a> TimespanTree<'a>

Source

pub fn timespans(&self) -> &[ElementTimespan<'a>]

Every timespan, in order.

Source

pub fn len(&self) -> usize

How many timespans there are.

Source

pub fn is_empty(&self) -> bool

Whether there are none.

Source

pub fn lowest_position(&self) -> Option<FloatType>

Where the earliest timespan starts: music21’s lowestPosition.

Source

pub fn highest_position(&self) -> Option<FloatType>

Where the latest starts: music21’s highestPosition.

Source

pub fn end_time(&self) -> Option<FloatType>

Where the last to end ends: music21’s endTime.

Source

pub fn all_offsets(&self) -> Vec<FloatType> ⓘ

Each offset a timespan starts at, once, in order: music21’s allOffsets.

Source

pub fn all_time_points(&self) -> Vec<FloatType> ⓘ

Each offset a timespan starts or ends at, once, in order: music21’s allTimePoints.

Source

pub fn position_after(&self, offset: FloatType) -> Option<FloatType>

The first offset after this one a timespan starts at: music21’s getPositionAfter.

Source

pub fn position_before(&self, offset: FloatType) -> Option<FloatType>

The last offset before this one a timespan starts at: music21’s getPositionBefore.

Source

pub fn starting_at(&self, offset: FloatType) -> Vec<&ElementTimespan<'a>>

The timespans starting at an offset: music21’s elementsStartingAt.

Source

pub fn stopping_at(&self, offset: FloatType) -> Vec<&ElementTimespan<'a>>

The timespans ending at an offset: music21’s elementsStoppingAt.

Source

pub fn overlapping(&self, offset: FloatType) -> Vec<&ElementTimespan<'a>>

The timespans sounding across an offset, started before it and ending after: music21’s elementsOverlappingOffset.

Source

pub fn overlap_time_points(&self, include_stop_points: bool) -> Vec<FloatType> ⓘ

The offsets a timespan starts at, or with include_stop_points also ends at, where another sounds across: music21’s overlapTimePoints.

Source

pub fn verticality_at(&self, offset: FloatType) -> Verticality<'_, 'a>

What starts, stops and sounds across an offset: music21’s getVerticalityAt.

Source

pub fn verticality_at_or_before( &self, offset: FloatType, ) -> Option<Verticality<'_, 'a>>

The verticality at an offset where something starts there, or the one before: music21’s getVerticalityAtOrBefore.

Source

pub fn verticalities(&self) -> Vec<Verticality<'_, 'a>>

The verticality at each offset a timespan starts at, in order: music21’s iterateVerticalities.

Source

pub fn maximum_overlap(&self) -> Option<usize>

The most timespans starting at or sounding across any one offset a timespan starts at, nothing for an empty tree: music21’s maximumOverlap.

Source

pub fn source(&self) -> &'a Stream

The stream the tree was read from: music21’s source.

Source

pub fn split_at(&mut self, offsets: &[FloatType])

Cuts every timespan sounding across one of these offsets in two there: music21’s splitAt. The pieces come after what already starts and ends where each does.

Source

pub fn verticalities_nwise( &self, n: usize, reverse: bool, pad_end: bool, ) -> Result<Vec<Vec<Verticality<'_, 'a>>>>

Runs of n verticalities, each starting one after the last, in order or reversed: music21’s iterateVerticalitiesNwise. Where there are fewer than n, or with pad_end at the end, a run is filled out with an empty verticality at the tree’s end.

§Errors

A run of no verticalities.

Source

pub fn consonance_bounded_verticalities( &self, ) -> Result<Vec<Vec<Verticality<'_, 'a>>>>

Each run of verticalities from one whose chord is consonant to the next that is, with at least one between: music21’s iterateConsonanceBoundedVerticalities.

§Errors

A verticality whose pitches make no chord.

Source

pub fn next_in_same_part( &self, timespan: &ElementTimespan<'a>, ) -> Option<&ElementTimespan<'a>>

The next timespan after this one, starting at a later offset, in the same part: music21’s findNextPitchedTimespanInSameStreamByClass.

Source

pub fn previous_in_same_part( &self, timespan: &ElementTimespan<'a>, ) -> Option<&ElementTimespan<'a>>

The timespan before this one, starting at an earlier offset, in the same part: music21’s findPreviousPitchedTimespanInSameStreamByClass.

Trait Implementations§

Source§

impl<'a> Clone for TimespanTree<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for TimespanTree<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for TimespanTree<'a>

§

impl<'a> RefUnwindSafe for TimespanTree<'a>

§

impl<'a> Send for TimespanTree<'a>

§

impl<'a> Sync for TimespanTree<'a>

§

impl<'a> Unpin for TimespanTree<'a>

§

impl<'a> UnsafeUnpin for TimespanTree<'a>

§

impl<'a> UnwindSafe for TimespanTree<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.