Skip to main content

Placement

Struct Placement 

Source
pub struct Placement<M, H> {
    pub position_measure: Option<M>,
    pub measure_position: FloatType,
    pub open_slurs: Vec<OpenSlur<M, H>>,
    pub tied_steps: Vec<TiedStep<M>>,
}
Expand description

The translator’s placing state: music21’s positionMeasure and measurePosition, openSlurs and tiedSteps.

Fields§

§position_measure: Option<M>

The measure placed in last: music21’s positionMeasure.

§measure_position: FloatType

Where the next object goes in it: music21’s measurePosition. Read only while the measure placed in is position_measure.

§open_slurs: Vec<OpenSlur<M, H>>

Slurs begun and not yet joined.

§tied_steps: Vec<TiedStep<M>>

Ties begun.

Implementations§

Source§

impl<M, H> Placement<M, H>

Source

pub fn position<T>( &mut self, music: &T, measure: &M, ) -> Result<FloatType, T::Error>
where T: Placing<Measure = M, Handle = H>,

music21’s currentPosition: the end of what the measure holds the first time it is asked in a measure, then where the notes placed last moved it on to.

§Errors

What the measure’s highest_time raises.

Source

pub fn mark<T>( &mut self, music: &mut T, measure: &M, element: T::Element, ) -> Result<(), T::Error>
where T: Placing<Measure = M, Handle = H>,

music21’s insertAtPosition: a mark where the next note goes.

§Errors

What placing it raises.

Source

pub fn tie<T>( &mut self, music: &mut T, measure: &M, element: &mut T::Element, steps: &[((char, IntegerType), bool)], ) -> Result<(), T::Error>
where T: Placing<Measure = M, Handle = H>,

music21’s setTieFromPitchInfo: the ties of an element about to go at the current position, from the staff step of each of its notes and whether the note is tied on. A note is tied from one on the same step that ends where it starts.

§Errors

What the measure or the element raises.

Source

pub fn place<T>( &mut self, music: &mut T, measure: &M, elements: Vec<(T::Element, bool)>, ) -> Result<(), T::Error>
where T: Placing<Measure = M, Handle = H>,

music21’s appendSimultaneous: notes, chords or rests, each with whether it is slurred, starting together at the current position, which then moves on by the shortest of them. Where several start together, or the measure has voices, each goes in a voice free there, the longest of them first, or a new one; the notes the measure holds become its first voice where it has none.

§Errors

What the measure raises.

Source

pub fn slurs<T>( &mut self, music: &mut T, measure: &M, group: &[(H, bool, FloatType)], ) -> Result<(), T::Error>
where T: Placing<Measure = M, Handle = H>,

music21’s setSlurs, for notes just placed together at the current position, each with whether it is slurred and how long it lasts: a slurred note is slurred to the next note starting once it has ended, the one in the same place in its group if there is one, else the first slurred one, else the first. Slurred notes in a row make one slur.

§Errors

What the measure raises.

Source

pub fn barline<T>(&mut self, music: &T, measure: &M) -> Result<(), T::Error>
where T: Placing<Measure = M, Handle = H>,

music21’s createBarlines for ties: a tie running to the end of the measure goes on into the next; any other is dropped.

§Errors

What the measure’s highest_time raises.

Source

pub fn new_staff(&mut self)

music21’s createStaff: nothing left open from the staff before.

Trait Implementations§

Source§

impl<M: Clone, H: Clone> Clone for Placement<M, H>

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<M: Debug, H: Debug> Debug for Placement<M, H>

Source§

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

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

impl<M, H> Default for Placement<M, H>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<M, H> Forget for Placement<M, H>

§

impl<M, H> Freeze for Placement<M, H>
where Option<M>: Freeze, Vec<OpenSlur<M, H>>: Freeze, Vec<TiedStep<M>>: Freeze,

§

impl<M, H> Move for Placement<M, H>

§

impl<M, H> RefUnwindSafe for Placement<M, H>

§

impl<M, H> Send for Placement<M, H>
where Option<M>: Send, Vec<OpenSlur<M, H>>: Send, Vec<TiedStep<M>>: Send,

§

impl<M, H> Sync for Placement<M, H>
where Option<M>: Sync, Vec<OpenSlur<M, H>>: Sync, Vec<TiedStep<M>>: Sync,

§

impl<M, H> Unpin for Placement<M, H>
where Option<M>: Unpin, Vec<OpenSlur<M, H>>: Unpin, Vec<TiedStep<M>>: Unpin,

§

impl<M, H> UnsafeUnpin for Placement<M, H>

§

impl<M, H> UnwindSafe for Placement<M, H>

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.