Skip to main content

NwcReader

Struct NwcReader 

Source
pub struct NwcReader<'a> {
    pub at: usize,
    pub version: u32,
    pub alterations: Vec<(i32, String)>,
    /* private fields */
}
Expand description

music21’s NWCConverter as a reader: the file, where it has got to in it, its version, and the alteration last written on each staff position, by the position modulo seven, until a barline.

Fields§

§at: usize

Where the next read starts: music21’s parsePosition.

§version: u32

The file’s version, as music21 numbers it: 175 for 1.75.

§alterations: Vec<(i32, String)>

music21’s currentAlterations.

Implementations§

Source§

impl<'a> NwcReader<'a>

Source

pub fn new(data: &'a [u8], version: u32) -> Self

A reader over a file’s (inflated) bytes, at its start, taken to be of version until its header says.

Source

pub fn header(&mut self) -> Result<NwcHeader>

music21’s parseHeader, with fileVersion read where music21 reads it. The version read is kept.

§Errors

A file that ends inside its header.

Source

pub fn staff(&mut self) -> Result<NwcStaff>

music21’s NWCStaff.parse: a staff’s header, its verses and its objects.

§Errors

A file that ends inside the staff, or an object music21 cannot read.

Source

pub fn staff_objects(&mut self) -> Result<(i32, Vec<NwcObject>)>

NWCStaff.parseObjects: how many objects the staff says it has, and the objects.

§Errors

As Self::staff.

Source

pub fn staff_header(&mut self) -> Result<NwcStaff>

NWCStaff.parseHeader: a staff’s names, settings and how many verses it has.

§Errors

As Self::staff.

Source

pub fn staff_lyrics(&mut self, verses: i32) -> Result<Vec<Vec<Vec<u8>>>>

NWCStaff.parseLyrics: each verse’s syllables.

§Errors

As Self::staff.

Source

pub fn object(&mut self) -> Result<NwcObject>

music21’s NWCObject.parse: an object of the type its first short names.

§Errors

An object of a kind music21 does not know, a file that ends inside it, or a note or rest in a file older than music21 reads.

Trait Implementations§

Source§

impl<'a> Clone for NwcReader<'a>

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<'a> Debug for NwcReader<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Forget for NwcReader<'a>

§

impl<'a> Freeze for NwcReader<'a>

§

impl<'a> Move for NwcReader<'a>

§

impl<'a> RefUnwindSafe for NwcReader<'a>

§

impl<'a> Send for NwcReader<'a>

§

impl<'a> Sync for NwcReader<'a>

§

impl<'a> Unpin for NwcReader<'a>

§

impl<'a> UnsafeUnpin for NwcReader<'a>

§

impl<'a> UnwindSafe for NwcReader<'a>

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.