Skip to main content

Spanner

Struct Spanner 

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

A mark joining several notes: music21’s Spanner.

Implementations§

Source§

impl Spanner

Source

pub fn new(kind: SpannerKind, spanned: Vec<usize>) -> Self

A spanner of a kind joining the elements at these positions.

Source

pub fn with_unplaced(kind: SpannerKind, spanned: Vec<Option<usize>>) -> Self

A spanner of a kind joining elements some of which stand nowhere: a score read from a file may leave a spanner holding a note no stream holds. It still counts that note among its own, so the ends and the length are those of the whole list.

Source

pub fn glissando(spanned: Vec<usize>) -> Self

A glissando over the elements at these positions, drawn as a wavy line and played chromatically, as music21’s starts out.

Source

pub fn glissando_details(&self) -> Option<&Glissando>

How a glissando is played and what is written along it.

Source

pub fn set_glissando_details(&mut self, glissando: Option<Glissando>)

Says how a glissando is played and what is written along it.

Source

pub fn tremolo(marks: u8, spanned: Vec<usize>) -> Result<Self>

A tremolo alternating between the elements at these positions, with so many strokes through the stems.

§Errors

More than eight strokes, as music21’s TremoloException.

Source

pub fn number_of_marks(&self) -> Option<u8>

How many strokes a tremolo between notes is written with: music21’s numberOfMarks.

Source

pub fn set_number_of_marks(&mut self, marks: Option<u8>) -> Result<()>

Says how many strokes a tremolo between notes is written with.

§Errors

More than eight, as music21’s TremoloException.

Source

pub fn offset(&self) -> FloatType

Where the spanner itself stands in the stream holding it: nought for one a score is read with. A pedal mark drawn as a sign and a line says where its line resumes by it.

Source

pub fn set_offset(&mut self, offset: FloatType)

Says where the spanner itself stands in the stream holding it.

Source

pub fn arpeggio_mark(arpeggio: ArpeggioType, spanned: Vec<usize>) -> Self

One arpeggio across the chords at these positions.

Source

pub fn arpeggio(&self) -> ArpeggioType

Which way an arpeggio across several chords is spread.

Source

pub fn set_arpeggio(&mut self, arpeggio: ArpeggioType)

Says which way an arpeggio across several chords is spread.

Source

pub fn line(spanned: Vec<usize>) -> Self

A line over the elements at these positions, solid with a tick down at each end, as music21’s starts out.

Source

pub fn ends(&self) -> LineEnds

How a line’s ends are drawn.

Source

pub fn set_ends(&mut self, ends: LineEnds)

Says how a line’s ends are drawn.

Source

pub fn pedal_mark(pedal: Pedal, spanned: Vec<usize>) -> Self

A pedal held under the elements at these positions.

Source

pub fn pedal(&self) -> Option<Pedal>

Which pedal a pedal mark holds and how it is drawn.

Source

pub fn set_pedal(&mut self, pedal: Option<Pedal>)

Says which pedal a pedal mark holds and how it is drawn.

Source

pub fn ottava(shift: OctaveShift, spanned: Vec<usize>) -> Self

An octave line over the elements at these positions, drawn above them as music21’s starts out.

Source

pub fn shift(&self) -> Option<OctaveShift>

How far and which way an octave line moves its notes.

Source

pub fn set_shift(&mut self, shift: Option<OctaveShift>)

Says how far and which way an octave line moves its notes.

Source

pub fn slur(spanned: Vec<usize>) -> Self

A slur over the elements at these positions.

Source

pub fn wedge(kind: SpannerKind, spanned: Vec<usize>) -> Self

A hairpin over the elements at these positions, drawn below them and opening fifteen tenths wide, as music21’s starts out.

Source

pub fn spread(&self) -> Option<FloatType>

How wide a hairpin opens, in tenths of a staff space: music21’s spread.

Source

pub fn set_spread(&mut self, spread: Option<FloatType>)

Says how wide a hairpin opens.

Source

pub fn kind(&self) -> SpannerKind

Which kind of spanner this is.

Source

pub fn spanned(&self) -> &[Option<usize>]

The positions of the elements it joins, first to last, nothing for one that stands in no stream.

Source

pub fn len(&self) -> usize

How many elements it joins, those standing nowhere included.

Source

pub fn is_empty(&self) -> bool

Whether it joins nothing at all.

Source

pub fn is_first(&self, position: usize) -> bool

Whether the element at a position is the first it joins: music21’s isFirst.

Source

pub fn is_last(&self, position: usize) -> bool

Whether the element at a position is the last it joins: music21’s isLast.

Source

pub fn placement(&self) -> Option<Placement>

Which side of the notes it is drawn on, where the score says.

Source

pub fn set_placement(&mut self, placement: Option<Placement>)

Says which side of the notes it is drawn on.

Source

pub fn line_type(&self) -> Option<&str>

How its line is drawn where that is not solid, dashed or dotted: music21’s style.lineType.

Source

pub fn set_line_type(&mut self, line_type: Option<String>)

Says how its line is drawn.

Trait Implementations§

Source§

impl Clone for Spanner

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 Spanner

Source§

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

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

impl<'de> Deserialize<'de> for Spanner

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 Eq for Spanner

Source§

impl PartialEq for Spanner

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 Spanner

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 Spanner

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.