pub struct Luthier { /* private fields */ }
Expand description
A Guitar
builder.
Implementations§
Source§impl Luthier
impl Luthier
Sourcepub fn new(num_frets: usize) -> Self
pub fn new(num_frets: usize) -> Self
Creates a new Luthier
to build a Guitar
with the given number
of frets.
§Examples
let luthier = gitar::Luthier::new(21);
Sourcepub fn string(self, tuning: Vec<Note>) -> Self
pub fn string(self, tuning: Vec<Note>) -> Self
Strings the luthier’s Guitar
with the given tuning
(a vector
of open string note values).
§Examples
use minstrel::Note;
use std::str::FromStr;
// Standard tuning for a bass guitar
let tuning = vec![
Note::from_str("E1").unwrap(),
Note::from_str("A1").unwrap(),
Note::from_str("D2").unwrap(),
Note::from_str("G2").unwrap(),
];
let luthier = gitar::Luthier::new(24).string(tuning);
Sourcepub fn add_capo(self, fret_number: usize) -> Self
pub fn add_capo(self, fret_number: usize) -> Self
Puts a ‘capo’ on the luthier’s Guitar
. This essentially shifts the
fret values of each string up by fret_number
of semitones. It also
reduces the number of frets on the guitar by the same amount.
§Examples
// Because of the capo, the resulting guitar will only have 18 functional
// frets, even though it was initialised with 22
let luthier = gitar::Luthier::new(22)
.string(gitar::standard_tuning())
.add_capo(4);
§Panics
This method panics if the given fret_number
is greater than the
number of frets on the luthier’s Guitar
, or if that Guitar
has
not been strung.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Luthier
impl RefUnwindSafe for Luthier
impl Send for Luthier
impl Sync for Luthier
impl Unpin for Luthier
impl UnwindSafe for Luthier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more