Skip to main content

Unpitched

Struct Unpitched 

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

A note with no pitch, as a drum stroke: music21’s note.Unpitched.

use music21_rs::percussion::Unpitched;

let stroke = Unpitched::new();
assert_eq!((stroke.display_step(), stroke.display_octave()), ('B', 4));

let low = Unpitched::from_display_name("D5")?;
assert_eq!(low.display_name(), "D5");

Implementations§

Source§

impl Unpitched

Source

pub fn new() -> Self

A stroke displayed on the middle line, B4, which is where music21 puts one that says nothing.

Source

pub fn from_display_name(name: &str) -> Result<Self>

A stroke displayed where this pitch would stand in treble clef. An accidental in the name is dropped, since a display position has none, and a name with no octave is displayed in the fourth.

Source

pub fn displayed_at(step: char, octave: IntegerType) -> Result<Self>

A stroke displayed at this step and octave.

Source

pub fn display_step(&self) -> char

The letter of the line or space it is displayed on: music21’s displayStep.

Source

pub fn display_octave(&self) -> IntegerType

The octave it is displayed in: music21’s displayOctave.

Source

pub fn display_pitch(&self) -> &Pitch

Where it is displayed, as a pitch, which never has an accidental: music21’s displayPitch.

Source

pub fn display_name(&self) -> String

Where it is displayed, as a name: music21’s displayName.

Source

pub fn set_display(&mut self, step: char, octave: IntegerType) -> Result<()>

Moves it to another line or space.

Source

pub fn duration(&self) -> Option<&Duration>

How long it lasts, where that has been said.

Source

pub fn with_duration(self, duration: Duration) -> Self

The same stroke lasting this long.

Source

pub fn stored_instrument(&self) -> Option<&Instrument>

The instrument that plays it, where one is kept on the stroke itself: music21’s storedInstrument.

Source

pub fn written(&self) -> &Note

Everything written about the stroke – its length, stem, notehead, beams, tie, lyrics, expressions – as a note standing where it is displayed. The note’s pitch is that position and nothing sounds it.

Source

pub fn written_mut(&mut self) -> &mut Note

What is written about the stroke, for editing. Changing the pitch moves where it is displayed.

Trait Implementations§

Source§

impl Clone for Unpitched

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 Unpitched

Source§

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

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

impl Default for Unpitched

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Unpitched

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<Unpitched> for PercussionNote

Source§

fn from(value: Unpitched) -> Self

Converts to this type from the input type.
Source§

impl From<Unpitched> for StreamElement

Source§

fn from(value: Unpitched) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Unpitched

Source§

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

Where they are displayed, what plays them and how long they last, as music21 compares them.

1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Unpitched

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§

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.