pub struct Line {
pub line_type: DataType,
pub text_data: String,
}
Expand description
A single line of a tab
This struct is normally generated by crate::tab_scraper::get_tab_lines
.
Fields§
§line_type: DataType
Type data stored on the line
text_data: String
The contents on the line as plain text
Implementations§
Source§impl Line
impl Line
Sourcepub fn replace_german_names(self) -> Line
pub fn replace_german_names(self) -> Line
Replace german chord names with english ones
Musical notation is one of the things Germans did their own, slightly more complicated way. This function will replace german names for chords with their english equivalents.
§Example:
use ug_scraper::types::{Line, DataType};
// Create a line with German chord names H, Dmoll, Fis, Es and B
let mut line: Line = Line { line_type: DataType::Chord,
text_data: "A H C Dmoll Fis Es B".to_string() };
// Replace the weïrd chord names
line = line.replace_german_names();
// Returns:
// "A B C Dm F# Eb Bb"
Note: Some of the German chord notations (e.g. Fes or Dmoll) are rarely found in any tabs. But to ensure they don’t confuse anyone, they are included in this function too.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Line
impl<'de> Deserialize<'de> for Line
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Line
Auto Trait Implementations§
impl Freeze for Line
impl RefUnwindSafe for Line
impl Send for Line
impl Sync for Line
impl Unpin for Line
impl UnwindSafe for Line
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