Skip to main content

Rest

Struct Rest 

Source
pub struct Rest { /* private fields */ }
Expand description

A silent musical event with a duration.

A rest may still carry words: a syllable written under a rest is how a score says a line is spoken there, or how a verse number sits at the start of a phrase that opens on a rest. music21 writes the lyric methods once on GeneralNote, and a rest has them as a note does.

Two rests are equal when they last as long; what is written under them does not count, as it does not in music21.

Implementations§

Source§

impl Rest

Source

pub fn new(duration: Duration) -> Self

Creates a rest with the supplied duration.

Source

pub fn full_measure(&self) -> Option<bool>

Whether the rest stands for the whole of its measure, however long it is written: music21’s fullMeasure, nothing for its auto. The MusicXML reader says so where music21’s does.

Source

pub fn set_full_measure(&mut self, full_measure: Option<bool>)

Says whether the rest stands for the whole of its measure.

Source

pub fn grace_note(&self, appoggiatura: bool) -> Self

This rest written as a grace note’s value and lasting no time: music21’s getGrace, which a rest has as a note does.

Source

pub fn tie(&self) -> Option<&Tie>

The tie written on the rest, which music21 lets a rest carry and a score now and then writes.

Source

pub fn set_tie(&mut self, tie: Option<Tie>)

Writes a tie on the rest, or takes it off.

Source

pub fn size(&self) -> Option<NoteSize>

How large the rest is drawn, where a score says, as a cue part’s rests are drawn small.

Source

pub fn set_size(&mut self, size: Option<NoteSize>)

Says how large the rest is drawn.

Source

pub fn step_shift(&self) -> IntegerType

How many staff steps above the middle line the rest is drawn, below where negative: music21’s stepShift, which a score uses to keep one voice’s rests out of another’s way.

Source

pub fn set_step_shift(&mut self, shift: IntegerType)

Says how many staff steps from the middle line it is drawn.

Source

pub fn expressions(&self) -> &[Expression]

The fermatas and other marks written over the rest: music21’s expressions, which a rest has as a note does.

Source

pub fn expressions_mut(&mut self) -> &mut Vec<Expression>

The same, to be changed.

Source

pub fn articulations(&self) -> &[Articulation]

The articulations written on the rest: music21’s articulations.

Source

pub fn articulations_mut(&mut self) -> &mut Vec<Articulation>

The same, to be changed.

Source

pub fn hidden(&self) -> bool

Whether it is left off the printed page, keeping its place and its time: music21’s style.hideObjectOnPrint, which a score uses for a rest that only fills out a voice.

Source

pub fn set_hidden(&mut self, hidden: bool)

Says whether it is left off the printed page.

Source

pub fn from_quarter_length(quarter_length: FloatType) -> Result<Self>

Creates a rest from a quarter-length value.

Source

pub fn duration(&self) -> &Duration

Returns the rest duration.

Source

pub fn set_duration(&mut self, duration: Duration)

Updates the rest duration.

Source

pub fn quarter_length(&self) -> FloatType

Returns the duration in quarter lengths.

Source

pub fn full_name(&self) -> String

The most complete name of the rest, its length included: music21’s fullName, Dotted Quarter Rest.

Source

pub fn lyrics(&self) -> &[Lyric]

The syllables written under the rest, one per verse.

Source

pub fn lyrics_mut(&mut self) -> &mut Vec<Lyric>

The syllables written under the rest, for editing in place.

Source

pub fn lyric(&self) -> Option<String>

The text of every verse, one per line: music21’s lyric.

Source

pub fn set_lyric(&mut self, lyric: Option<&str>)

Replaces every verse with one per line of the text, or clears them with None: music21’s lyric setter.

Source

pub fn add_lyric( &mut self, text: &str, number: Option<IntegerType>, apply_raw: bool, )

Adds a syllable as a verse: music21’s addLyric, which a rest has as a note has it. See crate::Note::add_lyric.

Source

pub fn insert_lyric(&mut self, text: &str, index: usize, apply_raw: bool)

Puts a syllable in front of the verse at index: music21’s insertLyric.

Trait Implementations§

Source§

impl Clone for Rest

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 Debug for Rest

Source§

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

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

impl Default for Rest

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Rest

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Duration> for Rest

Source§

fn from(value: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<Rest> for StreamElement

Source§

fn from(value: Rest) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Rest

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Rest

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Rest

§

impl RefUnwindSafe for Rest

§

impl Send for Rest

§

impl Sync for Rest

§

impl Unpin for Rest

§

impl UnsafeUnpin for Rest

§

impl UnwindSafe for Rest

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.