Struct Luthier

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

A Guitar builder.

Implementations§

Source§

impl Luthier

Source

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);
Source

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);
Source

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.

Source

pub fn build(self) -> Guitar

Returns the constructed Guitar, consuming the Luthier.

Trait Implementations§

Source§

impl Debug for Luthier

Source§

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

Formats the value using the given formatter. Read more

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.