Skip to main content

SegmentMatcher

Struct SegmentMatcher 

Source
pub struct SegmentMatcher {
    pub matching: Matching,
    pub repetitions: Repetitions,
    pub include_chords: bool,
}
Expand description

Finds the runs of a stream’s notes and chords that are segments or sets of pitch classes searched for: music21’s SegmentMatcher and the matchers built on it, chosen by Matching.

Fields§

§matching: Matching

How a run is told the same as a segment searched for.

§repetitions: Repetitions

How repeated pitch classes are read.

§include_chords: bool

Whether chords may be in a run.

Implementations§

Source§

impl SegmentMatcher

Source

pub fn new( matching: Matching, repetitions: Repetitions, include_chords: bool, ) -> Self

A matcher of this kind, reading repetitions so, chords included or not.

Source

pub fn find<'a>( &self, stream: &'a Stream, search: &[Vec<IntegerType>], ) -> Result<Vec<ContiguousSegment<'a>>>

Each run that matches one of the segments searched for, by the first it matches, in the order searched and found: music21’s find. A segment the same as one searched for already is passed over. A run matching two segments is listed for each, as music21 lists the one run twice, both times as it was matched last.

§Errors

As ContiguousSegmentSearcher::by_length.

Source

pub fn label( &self, stream: &Stream, named: &[(String, Vec<IntegerType>)], convention: Option<TransformationConvention>, ) -> Result<Stream>

A copy of the stream with each run found marked, as music21’s labelSegments and its kin mark them: a line spanner from its first note to its last, in its part, and the name of the segment it matched as a lyric of its first note, unless the note already carries that lyric. Runs are marked part by part, measure by measure, offset by offset. With a convention, as music21’s labelTransformedSegments takes one, each name is followed by the transformations taking the segment to the run, as ,T0 or ,P0.

§Errors

As SegmentMatcher::find.

Trait Implementations§

Source§

impl Clone for SegmentMatcher

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 Copy for SegmentMatcher

Source§

impl Debug for SegmentMatcher

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for SegmentMatcher

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.