The readme.md still mentions the use of PitchClass to use construct a Note.
use rustmt::note::{Note, PitchClass}
let note = Note::new(PitchClass::As, 4);
If I am not mistaken, this has since been renamed to PitchSymbol in the actual code. I wanted to update the readme, but the constructor has since been altered as well to now take a Pitch object instead. This was done in b7b277b.
This would make the required code for a constructor the following:
use rustmt::note::{Note, PitchSymbol}
let note = Note::new(PitchSymbol::As.into(), 4);
// Alternatively, this also works.
let note = Note::new(Pitch::from(PitchSymbol::As), 4);
Having good constructors as part of the API is undoubtedly very important.
Though this changed new()has been (erroneously?) part of the API now for quite a while, I suggest the argument for Note::new() to be changed back to PitchSymbol to reflect original intent (and documentation), or that a new convenience constructor should be implemented for this common operation.
I believe this is much clearer, and requires one less mental step for users.
use rustmt::note::{Note, PitchSymbol}
let note = Note::new(PitchSymbol::As, 4);
Alternatively, keep current Note::new() but add an additional Note::From_Symbol()
use rustmt::note::{Note, PitchSymbol}
let note = Note::from_symbol(PitchSymbol::As, 4);
The
readme.mdstill mentions the use ofPitchClassto use construct aNote.If I am not mistaken, this has since been renamed to
PitchSymbolin the actual code. I wanted to update the readme, but the constructor has since been altered as well to now take aPitchobject instead. This was done in b7b277b.This would make the required code for a constructor the following:
Having good constructors as part of the API is undoubtedly very important.
Though this changed
new()has been (erroneously?) part of the API now for quite a while, I suggest the argument forNote::new()to be changed back toPitchSymbolto reflect original intent (and documentation), or that a new convenience constructor should be implemented for this common operation.I believe this is much clearer, and requires one less mental step for users.
Alternatively, keep current
Note::new()but add an additionalNote::From_Symbol()