Skip to main content

Beams

Struct Beams 

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

The beams of one note, one for each level it is beamed at: music21’s beam.Beams.

Implementations§

Source§

impl Beams

Source

pub const LEVELS: usize

How many beams a written value carries, where it carries any: How many beams a written value can carry at the most: music21’s beamableDurationTypes, an eighth through a 2048th. It is how many depths a run of notes is beamed at.

Source

pub fn new() -> Self

No beams at all.

Source

pub fn beams(&self) -> &[Beam]

The beams, in level order.

Source

pub fn len(&self) -> usize

How many levels are beamed.

Source

pub fn is_empty(&self) -> bool

Whether the note carries no beam at all.

Source

pub fn feathered(&self) -> bool

Whether the group is drawn fanned out.

Source

pub fn set_feathered(&mut self, feathered: bool)

Draws the group fanned out, or stops doing so.

Source

pub fn beams_mut(&mut self) -> &mut Vec<Beam>

The beams, to be edited in place.

Source

pub fn set_beams(&mut self, beams: Vec<Beam>)

Replaces the beams outright.

Source

pub fn append( &mut self, beam_type: impl Into<Option<BeamType>>, direction: Option<BeamDirection>, )

Adds a beam at the next level down: music21’s append.

Source

pub fn levels_for(duration_type: DurationType) -> Option<u32>

music21’s beamableDurationTypes read as a count of levels.

Source

pub fn fill( &mut self, duration_type: DurationType, beam_type: Option<BeamType>, ) -> Result<()>

Gives the note as many beams as its written value has, all of the same type: music21’s fill.

A value that carries no beam — anything a quarter or longer — is an error, as it is upstream.

Source

pub fn fill_levels( &mut self, levels: u32, beam_type: Option<BeamType>, ) -> Result<()>

The same, counting the levels rather than naming the written value: music21 takes either, and fill(2) is a sixteenth.

The beams are left with nothing said about what they do, unless a type is given — music21 counts the lines first and decides them after.

Source

pub fn set_all(&mut self, beam_type: BeamType, direction: Option<BeamDirection>)

Sets every beam to the same type: music21’s setAll.

Source

pub fn by_number(&self, number: u32) -> Option<&Beam>

The beam at a level, counting from one: music21’s getByNumber.

Source

pub fn set_by_number( &mut self, number: u32, beam_type: BeamType, direction: Option<BeamDirection>, ) -> Result<()>

Sets the beam at a level, which must already be there.

Source

pub fn types(&self) -> Vec<Option<BeamType>>

The type of every beam, in level order: music21’s getTypes.

Source

pub fn numbers(&self) -> Vec<Option<u32>>

The level of every beam: music21’s getNumbers.

Trait Implementations§

Source§

impl Clone for Beams

Source§

fn clone(&self) -> Beams

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 Beams

Source§

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

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

impl Default for Beams

Source§

fn default() -> Beams

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

impl<'de> Deserialize<'de> for Beams

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 Display for Beams

Source§

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

music21’s _reprInternal: every beam, slash-separated.

Source§

impl Eq for Beams

Source§

impl Hash for Beams

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Beams

Source§

fn eq(&self, other: &Beams) -> 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 Beams

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
Source§

impl StructuralPartialEq for Beams

Auto Trait Implementations§

§

impl Freeze for Beams

§

impl RefUnwindSafe for Beams

§

impl Send for Beams

§

impl Sync for Beams

§

impl Unpin for Beams

§

impl UnsafeUnpin for Beams

§

impl UnwindSafe for Beams

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.