### equivalent method for guitarpro::model::mnx::layout::SystemLayout Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/direction/index.html?search=u32+-%3E+bool Compares two SystemLayout instances for equivalence. The generic parameter K is matched by u32. ```APIDOC ## equivalent ### Description Compares two SystemLayout instances for equivalence. ### Method `equivalent` ### Signature `fn equivalent(&self, other: &K) -> bool` ### Type Parameters - **K** - Must match `u32`. ### Parameters - **other** (`&K`) - The reference to compare against. ### Return Value - **bool** - `true` if equivalent, `false` otherwise. ``` -------------------------------- ### str::get example Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Example for the get method from Deref, returning a subslice of the string safely. ```rust let v = String::from("🗻∈🌏"); assert_eq!(Some("🗻"), v.get(0..4)); // indices not on UTF-8 sequence boundaries assert!(v.get(1..).is_none()); assert!(v.get(..8).is_none()); // out of bounds assert!(v.get(..42).is_none()); ``` -------------------------------- ### equivalent method for guitarpro::model::mnx::layout::SystemLayoutContent Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/direction/struct.Dynamics.html?search=u32+-%3E+bool Compares a SystemLayoutContent reference with a generic parameter K (where u32 matches K) and returns a boolean indicating equivalence. ```APIDOC ## equivalent(&self, other: &K) -> bool ### Description Compares the SystemLayoutContent with a generic parameter K (where u32 matches K) and returns true if they are equivalent. ### Method `equivalent` ### Parameters - `other` (reference to generic type K) - Required - The value to compare against. ### Return Value - `bool` - Returns true if the values are equivalent, false otherwise. ### Example ```rust let content = SystemLayoutContent::default(); let other = 0u32; let result = content.equivalent(&other); ``` ``` -------------------------------- ### str::as_ptr example Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Example for the as_ptr method from Deref, getting a raw pointer to the string's bytes. ```rust let s = "Hello"; let ptr = s.as_ptr(); ``` -------------------------------- ### strip_prefix example Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Removes a prefix exactly once, returning `Option<&str>`. Returns `None` if the string does not start with the prefix. The example shows three assertions. ```rust assert_eq!("foo:bar".strip_prefix("foo:"), Some("bar")); assert_eq!("foo:bar".strip_prefix("bar"), None); assert_eq!("foofoo".strip_prefix("foo"), Some("foo")); ``` -------------------------------- ### equivalent method for guitarpro::model::mnx::layout::StaffSource Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/direction/index.html?search=u32+-%3E+bool Compares two StaffSource instances for equivalence. The generic parameter K is matched by u32. ```APIDOC ## equivalent ### Description Compares two StaffSource instances for equivalence. ### Method `equivalent` ### Signature `fn equivalent(&self, other: &K) -> bool` ### Type Parameters - **K** - Must match `u32`. ### Parameters - **other** (`&K`) - The reference to compare against. ### Return Value - **bool** - `true` if equivalent, `false` otherwise. ``` -------------------------------- ### equivalent method for guitarpro::model::mnx::layout::LayoutStaff Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/direction/index.html?search=u32+-%3E+bool Compares two LayoutStaff instances for equivalence. The generic parameter K is matched by u32. ```APIDOC ## equivalent ### Description Compares two LayoutStaff instances for equivalence. ### Method `equivalent` ### Signature `fn equivalent(&self, other: &K) -> bool` ### Type Parameters - **K** - Must match `u32`. ### Parameters - **other** (`&K`) - The reference to compare against. ### Return Value - **bool** - `true` if equivalent, `false` otherwise. ``` -------------------------------- ### Test module setup for LossReport Source: https://docs.rs/guitarpro/latest/src/guitarpro/convert/mscz/validate.rs.html Starts the test module for LossReport, importing the outer scope. ```rust #[cfg(test)] mod tests { use super::*; ``` -------------------------------- ### equivalent method for System Source: https://docs.rs/guitarpro/latest/guitarpro/io/gpif/index.html?search=u32+-%3E+bool Checks equivalence between two System instances where u32 matches the generic parameter K. ```APIDOC ## equivalent ### Description Checks equivalence between two System instances where u32 matches the generic parameter K. ### Method `equivalent` ### Signature `&, &K -> bool` ### Type Parameters - **K** - matched by u32 ### Parameters - **&self** (reference) - The first value. - **&K** (reference) - The second value, where K is u32. ### Return Value - **bool** - `true` if equivalent, `false` otherwise. ``` -------------------------------- ### as_mut example Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Demonstrates Result::as_mut to get mutable references to the contained values, allowing mutation of the Ok or Err variant. ```rust fn mutate(r: &mut Result) { match r.as_mut() { Ok(v) => *v = 42, Err(e) => *e = 0, } } let mut x: Result = Ok(2); mutate(&mut x); assert_eq!(x.unwrap(), 42); let mut x: Result = Err(13); mutate(&mut x); assert_eq!(x.unwrap_err(), 0); ``` -------------------------------- ### char_indices: Iterate over characters with byte positions Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Shows how to use char_indices to get byte positions and characters. The first example counts characters and iterates through a simple ASCII string. The second example demonstrates that Unicode combining characters may occupy multiple bytes, affecting positions. ```rust let word = "goodbye"; let count = word.char_indices().count(); assert_eq!(7, count); let mut char_indices = word.char_indices(); assert_eq!(Some((0, 'g')), char_indices.next()); assert_eq!(Some((1, 'o')), char_indices.next()); assert_eq!(Some((2, 'o')), char_indices.next()); assert_eq!(Some((3, 'd')), char_indices.next()); assert_eq!(Some((4, 'b')), char_indices.next()); assert_eq!(Some((5, 'y')), char_indices.next()); assert_eq!(Some((6, 'e')), char_indices.next()); assert_eq!(None, char_indices.next()); ``` ```rust let yes = "y̆es"; let mut char_indices = yes.char_indices(); assert_eq!(Some((0, 'y')), char_indices.next()); // not (0, 'y̆') assert_eq!(Some((1, '\u{0306}')), char_indices.next()); // note the 3 here - the previous character took up two bytes assert_eq!(Some((3, 'e')), char_indices.next()); assert_eq!(Some((4, 's')), char_indices.next()); assert_eq!(None, char_indices.next()); ``` -------------------------------- ### equivalent methods Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/part_list/struct.ScorePart.html?search=u32+-%3E+bool A list of equivalent methods across various guitarpro model modules that accept a u32 generic parameter and return a bool. ```APIDOC ## equivalent methods ### Description These methods check equivalence with a u32 generic parameter and return a boolean. ### Methods - guitarpro::model::mnx::event::Space::equivalent - guitarpro::model::mnx::global::TimeSignatureUnit::equivalent - guitarpro::model::mnx::global::TimeSignatureDisplay::equivalent - guitarpro::model::mnx::global::TimeSignature::equivalent - guitarpro::model::mnx::global::KeySignature::equivalent - guitarpro::model::mnx::global::BarlineType::equivalent - guitarpro::model::mnx::global::Barline::equivalent - guitarpro::model::mnx::global::FermataDuration::equivalent - guitarpro::model::mnx::global::FermataSymbol::equivalent - guitarpro::model::mnx::global::UpDownAuto::equivalent - guitarpro::model::mnx::global::Fermata::equivalent - guitarpro::model::mnx::global::Ending::equivalent - guitarpro::model::mnx::global::RepeatStart::equivalent - guitarpro::model::mnx::global::RepeatEnd::equivalent - guitarpro::model::mnx::global::JumpType::equivalent - guitarpro::model::mnx::global::Jump::equivalent - guitarpro::model::mnx::global::Segno::equivalent - guitarpro::model::mnx::global::Fine::equivalent - guitarpro::model::mnx::layout::StaffSymbol::equivalent - guitarpro::model::mnx::layout::StaffGroupBarlineStyle::equivalent - guitarpro::model::mnx::layout::StaffLabelRef::equivalent - guitarpro::model::mnx::layout::StaffSource::equivalent - guitarpro::model::mnx::layout::LayoutStaff::equivalent - guitarpro::model::mnx::layout::SystemLayoutContent::equivalent - guitarpro::model::mnx::layout::StaffGroup::equivalent - guitarpro::model::mnx::layout::SystemLayout::equivalent - guitarpro::model::mnx::lyrics::EventLyricLineType::equivalent - guitarpro::model::mnx::lyrics::EventLyricLine::equivalent - guitarpro::model::mnx::lyrics::Lyrics::equivalent - guitarpro::model::mnx::lyrics::LyricLineMetadata::equivalent - guitarpro::model::mnx::lyrics::LyricsGlobal::equivalent - guitarpro::model::mnx::measure::ClefSign::equivalent - guitarpro::model::mnx::measure::OttavaAmountOrZero::equivalent - guitarpro::model::mnx::measure::OttavaAmount::equivalent - guitarpro::model::mnx::measure::Clef::equivalent - guitarpro::model::mnx::measure::PositionedClef::equivalent - guitarpro::model::mnx::measure::BeamHookDirection::equivalent - guitarpro::model::mnx::measure::Beam::equivalent - guitarpro::model::mnx::measure::Dynamic::equivalent - guitarpro::model::mnx::measure::Ottava::equivalent - guitarpro::model::mnx::note::AccidentalEnclosureSymbol::equivalent - guitarpro::model::mnx::note::AccidentalEnclosure::equivalent - guitarpro::model::mnx::note::AccidentalDisplay::equivalent - guitarpro::model::mnx::note::PerformOptions::equivalent - guitarpro::model::mnx::note::TieTargetType::equivalent ### Signature &, &K -> bool where u32 matches K ### Parameters - **&** (reference) - Required - The reference to the object. - **&K** (reference) - Required - The reference to the generic parameter K, which matches u32. ### Return Value - **bool** - True if the objects are equivalent, false otherwise. ``` -------------------------------- ### equivalent methods for u32 key comparison Source: https://docs.rs/guitarpro/latest/guitarpro/model/optimized/timeline/struct.Marker.html?search=u32+-%3E+bool These methods check if a given key (generic K) is equivalent to a u32 value. They are implemented across many model types in the guitarpro crate. ```APIDOC ## Method: equivalent ### Description Checks if the provided key (generic K) is equivalent to a u32 value. Returns true if the key matches u32, false otherwise. ### Method `equivalent` ### Signature `&self, &K -> bool` where `u32: PartialEq` ### Parameters - **key** (`&K`) - The key to compare against u32. ### Return Value - **bool** - `true` if the key is equivalent to a u32 value, `false` otherwise. ### Implementations - `guitarpro::model::optimized::effect::RehearsalEnclosure::equivalent` - `guitarpro::model::optimized::global::InstrumentId::equivalent` - `guitarpro::model::optimized::global::TrackId::equivalent` - `guitarpro::model::optimized::global::StaffId::equivalent` - `guitarpro::model::optimized::global::LyricLineId::equivalent` - `guitarpro::model::optimized::global::MeasureIndex::equivalent` - `guitarpro::model::optimized::global::GroupSymbol::equivalent` - `guitarpro::model::optimized::global::GroupBarline::equivalent` - `guitarpro::model::optimized::global::Transpose::equivalent` - `guitarpro::model::optimized::metadata::TextJustify::equivalent` - `guitarpro::model::optimized::metadata::TextValign::equivalent` - `guitarpro::model::optimized::metadata::TimeSignature::equivalent` - `guitarpro::model::optimized::metadata::KeySignature::equivalent` - `guitarpro::model::optimized::metadata::Mode::equivalent` - `guitarpro::model::optimized::metadata::DegreeKind::equivalent` - `guitarpro::model::optimized::metadata::BarreKind::equivalent` - `guitarpro::model::optimized::note::PitchStep::equivalent` - `guitarpro::model::optimized::note::Pitch::equivalent` - `guitarpro::model::optimized::note::NoteValue::equivalent` - `guitarpro::model::optimized::note::TieType::equivalent` - `guitarpro::model::optimized::note::Ornament::equivalent` - `guitarpro::model::optimized::note::Articulation::equivalent` - `guitarpro::model::optimized::note::TechniqueKind::equivalent` - `guitarpro::model::optimized::note::Notehead::equivalent` - `guitarpro::model::optimized::note::StemDirection::equivalent` - `guitarpro::model::optimized::note::AccidentalDisplay::equivalent` - `guitarpro::model::optimized::note::ArpeggiateDirection::equivalent` - `guitarpro::model::optimized::note::ArpeggiateKind::equivalent` - `guitarpro::model::optimized::note::Finger::equivalent` - `guitarpro::model::optimized::timeline::BarlineStyle::equivalent` - `guitarpro::model::optimized::timeline::EndingKind::equivalent` - `guitarpro::model::optimized::timeline::MarkerKind::equivalent` - `guitarpro::model::optimized::timeline::JumpKind::equivalent` - `guitarpro::model::optimized::track::Clef::equivalent` - `guitarpro::model::optimized::track::StaffDisplay::equivalent` - `guitarpro::model::optimized::track::MeasureRepeatKind::equivalent` ``` -------------------------------- ### TieType enum definition Source: https://docs.rs/guitarpro/latest/guitarpro/model/optimized/note/enum.TieType.html?search= Defines the TieType enum with variants Start and End. Start indicates the note starts a tie chain, extending sounding duration to the End note. End indicates no new MIDI attack and extends the Start note's duration. ```rust pub enum TieType { Start, End, } ``` -------------------------------- ### equivalent methods for guitarpro model types Source: https://docs.rs/guitarpro/latest/guitarpro/io/gpif/struct.Automation.html?search=u32+-%3E+bool A collection of equivalent methods for various guitarpro model types. Each method takes two references and returns a bool, with a constraint that u32 matches the generic parameter K. ```APIDOC ## equivalent methods for guitarpro model types ### Description These methods check if a u32 value is equivalent to a given model type. They are defined for various enums and structs in the guitarpro crate. ### Method `equivalent` ### Signature `fn equivalent(&self, other: &K) -> bool where u32: PartialEq` ### Parameters - `&self` - Reference to the model type instance. - `&K` - Reference to the value to compare against, where `u32` must match `K`. ### Return Value - `bool` - Returns `true` if the values are equivalent, `false` otherwise. ### Implementations - `guitarpro::model::legacy::enums::BeatStatus::equivalent` - `guitarpro::model::legacy::enums::TupletBracket::equivalent` - `guitarpro::model::legacy::enums::Octave::equivalent` - `guitarpro::model::legacy::enums::BeatStrokeDirection::equivalent` - `guitarpro::model::legacy::enums::SlapEffect::equivalent` - `guitarpro::model::legacy::enums::VoiceDirection::equivalent` - `guitarpro::model::legacy::enums::ChordType::equivalent` - `guitarpro::model::legacy::enums::ChordAlteration::equivalent` - `guitarpro::model::legacy::enums::ChordExtension::equivalent` - `guitarpro::model::legacy::enums::BendType::equivalent` - `guitarpro::model::legacy::enums::GraceEffectTransition::equivalent` - `guitarpro::model::legacy::enums::HarmonicType::equivalent` - `guitarpro::model::legacy::enums::TripletFeel::equivalent` - `guitarpro::model::legacy::enums::DirectionSign::equivalent` - `guitarpro::model::legacy::enums::SlideType::equivalent` - `guitarpro::model::legacy::enums::NoteType::equivalent` - `guitarpro::model::legacy::enums::Fingering::equivalent` - `guitarpro::model::legacy::headers::Version::equivalent` - `guitarpro::model::legacy::headers::Clipboard::equivalent` - `guitarpro::model::legacy::key_signature::TimeSignature::equivalent` - `guitarpro::model::legacy::key_signature::KeySignature::equivalent` - `guitarpro::model::legacy::key_signature::Duration::equivalent` - `guitarpro::model::legacy::mix_table::MixTableItem::equivalent` - `guitarpro::model::legacy::mix_table::WahEffect::equivalent` - `guitarpro::model::legacy::mix_table::MixTableChange::equivalent` - `guitarpro::model::legacy::note::NoteEffect::equivalent` - `guitarpro::model::legacy::rse::RseInstrument::equivalent` - `guitarpro::model::mnx::MnxId::equivalent` - `guitarpro::model::mnx::MidiNumber::equivalent` - `guitarpro::model::mnx::Orientation::equivalent` - `guitarpro::model::mnx::event::LineType::equivalent` - `guitarpro::model::mnx::event::SlurSide::equivalent` - `guitarpro::model::mnx::event::StemDirection::equivalent` - `guitarpro::model::mnx::event::BowDirection::equivalent` - `guitarpro::model::mnx::event::Slur::equivalent` - `guitarpro::model::mnx::event::SingleNoteTremolo::equivalent` - `guitarpro::model::mnx::event::Accent::equivalent` - `guitarpro::model::mnx::event::SoftAccent::equivalent` - `guitarpro::model::mnx::event::StrongAccent::equivalent` - `guitarpro::model::mnx::event::BreathMark::equivalent` - `guitarpro::model::mnx::event::Spiccato::equivalent` - `guitarpro::model::mnx::event::Staccatissimo::equivalent` - `guitarpro::model::mnx::event::Staccato::equivalent` - `guitarpro::model::mnx::event::StressMarking::equivalent` - `guitarpro::model::mnx::event::Tenuto::equivalent` ``` -------------------------------- ### Compute measure start ticks Source: https://docs.rs/guitarpro/latest/src/guitarpro/convert/legacy/mod.rs.html?search=std%3A%3Avec Calculates the starting tick for each measure based on time signatures, starting at DURATION_QUARTER_TIME (960). Updates running time signature when a measure defines one. ```rust fn compute_measure_starts(timeline: &[MeasureDef]) -> Vec { let mut starts = Vec::with_capacity(timeline.len()); let mut pos: i64 = DURATION_QUARTER_TIME; // first measure at tick 960 let mut running_num: i64 = 4; let mut running_den: i64 = 4; for md in timeline { starts.push(pos); if let Some(ts) = md.time_signature { running_num = ts.numerator as i64; running_den = ts.denominator as i64; } let length = if running_den > 0 { running_num * DURATION_QUARTER_TIME * 4 / running_den } else { running_num * DURATION_QUARTER_TIME }; pos += length; } starts } ``` -------------------------------- ### Result::is_err Example Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Examples of using is_err to check if a Result is Err. ```rust let x: Result = Ok(-3); assert_eq!(x.is_err(), false); let x: Result = Err("Some error message"); assert_eq!(x.is_err(), true); ``` -------------------------------- ### equivalent methods Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/direction/struct.MetronomeNote.html?search=u32+-%3E+bool List of equivalent methods for various types in the guitarpro model, each taking a reference and a u32 and returning a boolean. ```APIDOC ## equivalent methods ### Description These methods check if a given u32 value matches the type. Each method takes a reference to the type and a u32 and returns a boolean. ### Method equivalent ### Parameters - **value** (u32) - Required - The u32 value to compare. ### Return Value - **bool** - Returns true if the value matches, false otherwise. ### Types - TimeSignature::equivalent - KeySignature::equivalent - Mode::equivalent - DegreeKind::equivalent - BarreKind::equivalent - PitchStep::equivalent - Pitch::equivalent - NoteValue::equivalent - TieType::equivalent - Ornament::equivalent - Articulation::equivalent - TechniqueKind::equivalent - Notehead::equivalent - StemDirection::equivalent - AccidentalDisplay::equivalent - ArpeggiateDirection::equivalent - ArpeggiateKind::equivalent - Finger::equivalent - BarlineStyle::equivalent - EndingKind::equivalent - MarkerKind::equivalent - JumpKind::equivalent - Clef::equivalent - StaffDisplay::equivalent - MeasureRepeatKind::equivalent ``` -------------------------------- ### Result::is_ok Example Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Examples of using is_ok to check if a Result is Ok. ```rust let x: Result = Ok(-3); assert_eq!(x.is_ok(), true); let x: Result = Err("Some error message"); assert_eq!(x.is_ok(), false); ``` -------------------------------- ### equivalent methods Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/measure/index.html?search=u32+-%3E+bool A collection of equivalent methods for various guitarpro model types. Each method checks if a u32 value matches a generic key K and returns a boolean. ```APIDOC ## equivalent methods ### Description These methods check if a u32 value matches a generic key K and return a boolean. They are defined on various guitarpro model types. ### Method `equivalent` ### Signature `&self, &K -> bool` where `u32: matches K` ### Types - `guitarpro::model::optimized::metadata::BarreKind` - `guitarpro::model::optimized::note::PitchStep` - `guitarpro::model::optimized::note::Pitch` - `guitarpro::model::optimized::note::NoteValue` - `guitarpro::model::optimized::note::TieType` - `guitarpro::model::optimized::note::Ornament` - `guitarpro::model::optimized::note::Articulation` - `guitarpro::model::optimized::note::TechniqueKind` - `guitarpro::model::optimized::note::Notehead` - `guitarpro::model::optimized::note::StemDirection` - `guitarpro::model::optimized::note::AccidentalDisplay` - `guitarpro::model::optimized::note::ArpeggiateDirection` - `guitarpro::model::optimized::note::ArpeggiateKind` - `guitarpro::model::optimized::note::Finger` - `guitarpro::model::optimized::timeline::BarlineStyle` - `guitarpro::model::optimized::timeline::EndingKind` - `guitarpro::model::optimized::timeline::MarkerKind` - `guitarpro::model::optimized::timeline::JumpKind` - `guitarpro::model::optimized::track::Clef` - `guitarpro::model::optimized::track::StaffDisplay` - `guitarpro::model::optimized::track::MeasureRepeatKind` ### Parameters - `&self` - reference to the type instance - `&K` - reference to a generic key K, where u32 matches K ### Return Value - `bool` - true if the u32 value matches K, false otherwise ### Example ```rust let value: u32 = 1; let key: SomeKey = ...; let result = instance.equivalent(&key); ``` ``` -------------------------------- ### Result::flatten Example Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Examples of flattening nested Results, including multiple levels. ```rust let x: Result, u32> = Ok(Ok("hello")); assert_eq!(Ok("hello"), x.flatten()); let x: Result, u32> = Ok(Err(6)); assert_eq!(Err(6), x.flatten()); let x: Result, u32> = Err(6); assert_eq!(Err(6), x.flatten()); ``` ```rust let x: Result, u32>, u32> = Ok(Ok(Ok("hello"))); assert_eq!(Ok(Ok("hello")), x.flatten()); assert_eq!(Ok("hello"), x.flatten().flatten()); ``` -------------------------------- ### equivalent method for guitarpro::model::legacy::headers::Version Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/part/index.html?search=u32+-%3E+bool Compares two Version instances for equivalence, returning a boolean. The generic parameter K matches u32. ```APIDOC ## equivalent ### Description Compares two Version instances for equivalence, returning a boolean. The generic parameter K matches u32. ### Method method ### Signature &, &K -> bool ### Type Parameters - K: matches u32 ### Parameters - & (reference to Version) - The first value to compare. - &K (reference to generic type K) - The second value to compare, where K matches u32. ### Return Value - bool - True if the two values are equivalent, false otherwise. ``` -------------------------------- ### String::word_to_titlecase Greek sigma examples Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html?search=u32+-%3E+bool Tricky examples with Greek sigma. The first example shows a single word, and the second shows a multi-word string where only the first cased letter is uppercased and the rest are lowercased. ```rust #![feature(titlecase)] let odysseus = "ὈΔΥΣΣΕΎΣ"; assert_eq!("Ὀδυσσεύς", odysseus.word_to_titlecase()); let odysseus_king_of_ithaca = "Ο ΟΔΥΣΣΈΑΣ ΒΑΣΙΛΙΆΣ ΤΗΣ ΙΘΆΚΗΣ"; assert_eq!("Ο Οδυσσέας Βασιλιάς Της Ιθάκης", odysseus_king_of_ithaca.word_to_titlecase()); ``` -------------------------------- ### equivalent method for u32-compatible types Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/attributes/struct.Key.html?search=u32+-%3E+bool The equivalent method is defined on multiple types in the guitarpro crate. It accepts a reference to a generic key K where u32 matches K and returns a boolean indicating whether the type is equivalent to the key. ```APIDOC ## equivalent method ### Description Checks if the current type is equivalent to a given key of type K, where K is constrained to u32. Returns true if equivalent, false otherwise. ### Method method ### Signature fn equivalent(&self, key: &K) -> bool where u32 matches K ### Parameters - **key** (&K) - Required - The key to compare against, where K is a type that u32 matches. ### Return Value - **bool** - Returns true if the type is equivalent to the key, false otherwise. ### Implementations The equivalent method is implemented on the following types: - guitarpro::model::legacy::enums::ChordExtension - guitarpro::model::legacy::enums::BendType - guitarpro::model::legacy::enums::GraceEffectTransition - guitarpro::model::legacy::enums::HarmonicType - guitarpro::model::legacy::enums::TripletFeel - guitarpro::model::legacy::enums::DirectionSign - guitarpro::model::legacy::enums::SlideType - guitarpro::model::legacy::enums::NoteType - guitarpro::model::legacy::enums::Fingering - guitarpro::model::legacy::headers::Version - guitarpro::model::legacy::headers::Clipboard - guitarpro::model::legacy::key_signature::TimeSignature - guitarpro::model::legacy::key_signature::KeySignature - guitarpro::model::legacy::key_signature::Duration - guitarpro::model::legacy::mix_table::MixTableItem - guitarpro::model::legacy::mix_table::WahEffect - guitarpro::model::legacy::mix_table::MixTableChange - guitarpro::model::legacy::note::NoteEffect - guitarpro::model::legacy::rse::RseInstrument - guitarpro::model::mnx::MnxId - guitarpro::model::mnx::MidiNumber - guitarpro::model::mnx::Orientation - guitarpro::model::mnx::event::LineType - guitarpro::model::mnx::event::SlurSide - guitarpro::model::mnx::event::StemDirection - guitarpro::model::mnx::event::BowDirection - guitarpro::model::mnx::event::Slur - guitarpro::model::mnx::event::SingleNoteTremolo - guitarpro::model::mnx::event::Accent - guitarpro::model::mnx::event::SoftAccent - guitarpro::model::mnx::event::StrongAccent - guitarpro::model::mnx::event::BreathMark - guitarpro::model::mnx::event::Spiccato - guitarpro::model::mnx::event::Staccatissimo - guitarpro::model::mnx::event::Staccato - guitarpro::model::mnx::event::StressMarking - guitarpro::model::mnx::event::Tenuto - guitarpro::model::mnx::event::UnstressMarking - guitarpro::model::mnx::event::EventMarkings - guitarpro::model::mnx::event::KitNote - guitarpro::model::mnx::event::Rest - guitarpro::model::mnx::event::FullMeasureRest - guitarpro::model::mnx::event::GraceType - guitarpro::model::mnx::event::TupletDisplaySetting - guitarpro::model::mnx::event::YesNoAuto ``` -------------------------------- ### Result::is_ok_and Example Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Examples of using is_ok_and to check if the Ok value matches a predicate. ```rust let x: Result = Ok(2); assert_eq!(x.is_ok_and(|x| x > 1), true); let x: Result = Ok(0); assert_eq!(x.is_ok_and(|x| x > 1), false); let x: Result = Err("hey"); assert_eq!(x.is_ok_and(|x| x > 1), false); let x: Result = Ok("ownership".to_string()); assert_eq!(x.as_ref().is_ok_and(|x| x.len() > 1), true); println!("still alive {:?}", x); ``` -------------------------------- ### equivalent method for guitarpro::model::mnx::MnxId Source: https://docs.rs/guitarpro/latest/guitarpro/convert/legacy/index.html?search=u32+-%3E+bool Compares a MnxId instance with a generic value K and returns true if they are equivalent. ```APIDOC ## equivalent ### Description Compares a MnxId instance with a generic value K and returns true if they are equivalent. ### Method method ### Signature &, &**K** -> **bool** ### Type Parameters - **K** - The type to compare against. The source indicates u32 matches K. ### Parameters - **self** (&) - The MnxId instance. - **other** (&**K**) - The value to compare with. ### Return Value - **bool** - Returns true if equivalent, false otherwise. ``` -------------------------------- ### Result::transpose Example Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Example of transposing a Result, E> into an Option>. ```rust #[derive(Debug, Eq, PartialEq)] struct SomeErr; let x: Result, SomeErr> = Ok(Some(5)); let y: Option> = Some(Ok(5)); assert_eq!(x.transpose(), y); ``` -------------------------------- ### equivalent methods for various types Source: https://docs.rs/guitarpro/latest/guitarpro/model/legacy/measure/struct.Measure.html?search=u32+-%3E+bool A list of equivalent methods for various types in the guitarpro model, all taking a u32 and returning a bool. ```APIDOC ## equivalent methods ### Description These methods check equivalence with a u32 value and return a boolean. ### Method equivalent ### Parameters - **u32** - The value to compare against. ### Return Value - **bool** - Returns true if the value is equivalent, false otherwise. ### Types - guitarpro::model::legacy::enums::BeatStrokeDirection - guitarpro::model::legacy::enums::SlapEffect - guitarpro::model::legacy::enums::VoiceDirection - guitarpro::model::legacy::enums::ChordType - guitarpro::model::legacy::enums::ChordAlteration - guitarpro::model::legacy::enums::ChordExtension - guitarpro::model::legacy::enums::BendType - guitarpro::model::legacy::enums::GraceEffectTransition - guitarpro::model::legacy::enums::HarmonicType - guitarpro::model::legacy::enums::TripletFeel - guitarpro::model::legacy::enums::DirectionSign - guitarpro::model::legacy::enums::SlideType - guitarpro::model::legacy::enums::NoteType - guitarpro::model::legacy::enums::Fingering - guitarpro::model::legacy::headers::Version - guitarpro::model::legacy::headers::Clipboard - guitarpro::model::legacy::key_signature::TimeSignature - guitarpro::model::legacy::key_signature::KeySignature - guitarpro::model::legacy::key_signature::Duration - guitarpro::model::legacy::mix_table::MixTableItem - guitarpro::model::legacy::mix_table::WahEffect - guitarpro::model::legacy::mix_table::MixTableChange - guitarpro::model::legacy::note::NoteEffect - guitarpro::model::legacy::rse::RseInstrument - guitarpro::model::mnx::MnxId - guitarpro::model::mnx::MidiNumber - guitarpro::model::mnx::Orientation - guitarpro::model::mnx::event::LineType - guitarpro::model::mnx::event::SlurSide - guitarpro::model::mnx::event::StemDirection - guitarpro::model::mnx::event::BowDirection - guitarpro::model::mnx::event::Slur - guitarpro::model::mnx::event::SingleNoteTremolo - guitarpro::model::mnx::event::Accent - guitarpro::model::mnx::event::SoftAccent - guitarpro::model::mnx::event::StrongAccent - guitarpro::model::mnx::event::BreathMark - guitarpro::model::mnx::event::Spiccato - guitarpro::model::mnx::event::Staccatissimo - guitarpro::model::mnx::event::Staccato - guitarpro::model::mnx::event::StressMarking - guitarpro::model::mnx::event::Tenuto - guitarpro::model::mnx::event::UnstressMarking - guitarpro::model::mnx::event::EventMarkings - guitarpro::model::mnx::event::KitNote ``` -------------------------------- ### split: Separators at start or end Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Shows that separators at the start or end of a string are neighbored by empty strings. ```rust let d: Vec<_> = "010".split("0").collect(); assert_eq!(d, &["", "1", ""]); ``` -------------------------------- ### equivalent method for guitarpro::model::mnx::layout::SystemLayout Source: https://docs.rs/guitarpro/latest/guitarpro/io/gpif/struct.MasterBar.html?search=u32+-%3E+bool Checks if a u32 value matches the generic parameter K for SystemLayout. ```APIDOC ## equivalent ### Description Checks if a u32 value matches the generic parameter K for SystemLayout. ### Method method ### Signature &, &K -> bool ### Type Parameters - **K** - The generic type to compare against, where u32 matches K. ### Parameters - **&self** - Reference to the SystemLayout instance. - **&K** - Reference to the value to compare. ### Return Value - **bool** - Returns true if the u32 value matches K, false otherwise. ``` -------------------------------- ### equivalent methods for Guitar Pro model types Source: https://docs.rs/guitarpro/latest/guitarpro/audio/midi/struct.MidiChannel.html?search=u32+-%3E+bool A collection of equivalent method signatures for various Guitar Pro model types, each taking a reference to the type and a u32 value and returning a boolean. ```APIDOC ## equivalent methods for Guitar Pro model types ### Description These methods check whether a u32 value matches a specific type instance. Each method is defined on a type in the guitarpro model and returns a boolean. ### Method method ### Signature &, &K -> bool where u32 matches K ### Types with equivalent method - guitarpro::model::legacy::enums::ChordType - guitarpro::model::legacy::enums::ChordAlteration - guitarpro::model::legacy::enums::ChordExtension - guitarpro::model::legacy::enums::BendType - guitarpro::model::legacy::enums::GraceEffectTransition - guitarpro::model::legacy::enums::HarmonicType - guitarpro::model::legacy::enums::TripletFeel - guitarpro::model::legacy::enums::DirectionSign - guitarpro::model::legacy::enums::SlideType - guitarpro::model::legacy::enums::NoteType - guitarpro::model::legacy::enums::Fingering - guitarpro::model::legacy::headers::Version - guitarpro::model::legacy::headers::Clipboard - guitarpro::model::legacy::key_signature::TimeSignature - guitarpro::model::legacy::key_signature::KeySignature - guitarpro::model::legacy::key_signature::Duration - guitarpro::model::legacy::mix_table::MixTableItem - guitarpro::model::legacy::mix_table::WahEffect - guitarpro::model::legacy::mix_table::MixTableChange - guitarpro::model::legacy::note::NoteEffect - guitarpro::model::legacy::rse::RseInstrument - guitarpro::model::mnx::MnxId - guitarpro::model::mnx::MidiNumber - guitarpro::model::mnx::Orientation - guitarpro::model::mnx::event::LineType - guitarpro::model::mnx::event::SlurSide - guitarpro::model::mnx::event::StemDirection - guitarpro::model::mnx::event::BowDirection - guitarpro::model::mnx::event::Slur - guitarpro::model::mnx::event::SingleNoteTremolo - guitarpro::model::mnx::event::Accent - guitarpro::model::mnx::event::SoftAccent - guitarpro::model::mnx::event::StrongAccent - guitarpro::model::mnx::event::BreathMark - guitarpro::model::mnx::event::Spiccato - guitarpro::model::mnx::event::Staccatissimo - guitarpro::model::mnx::event::Staccato - guitarpro::model::mnx::event::StressMarking - guitarpro::model::mnx::event::Tenuto - guitarpro::model::mnx::event::UnstressMarking - guitarpro::model::mnx::event::EventMarkings - guitarpro::model::mnx::event::KitNote - guitarpro::model::mnx::event::Rest - guitarpro::model::mnx::event::FullMeasureRest - guitarpro::model::mnx::event::GraceType ### Parameters - **self** (&Self) - Required - The reference to the type instance. - **K** (u32) - Required - The u32 value to compare against. ### Return Value - **bool** - Returns true if the u32 value matches the type, false otherwise. ``` -------------------------------- ### trim_start method examples Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Examples of using trim_start to remove leading whitespace, including a demonstration of directionality. ```rust let s = "\n Hello\tworld\t\n"; assert_eq!("Hello\tworld\t\n", s.trim_start()); ``` ```rust let s = " English "; assert!(Some('E') == s.trim_start().chars().next()); ``` -------------------------------- ### equivalent method for SystemLayout Source: https://docs.rs/guitarpro/latest/guitarpro/model/musicxml/barline/index.html?search=u32+-%3E+bool The equivalent method for the SystemLayout type in the guitarpro::model::mnx::layout module. It takes a reference to the type and a reference to a generic key K (where u32 matches K) and returns a boolean. ```APIDOC ## equivalent(&self, &K) -> bool ### Description Determines if the SystemLayout instance is equivalent to the given key K, where K is a u32 type. ### Method `equivalent` ### Parameters - `&self` - Reference to the SystemLayout instance. - `&K` - Reference to the key of type K, where K matches u32. ### Return Value - `bool` - Returns true if equivalent, false otherwise. ``` -------------------------------- ### Result::cloned Example for &T Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Example of using the cloned method on a Result<&T, E> to clone the Ok value. ```rust let val = 12; let x: Result<&i32, i32> = Ok(&val); assert_eq!(x, Ok(&12)); let cloned = x.cloned(); assert_eq!(cloned, Ok(12)); ``` -------------------------------- ### Result::copied Example for &T Source: https://docs.rs/guitarpro/latest/guitarpro/error/type.GpResult.html Example of using the copied method on a Result<&T, E> to copy the Ok value. ```rust let val = 12; let x: Result<&i32, i32> = Ok(&val); assert_eq!(x, Ok(&12)); let copied = x.copied(); assert_eq!(copied, Ok(12)); ``` -------------------------------- ### word_to_titlecase example Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html?search=u32+-%3E+bool Asserts that the `word_to_titlecase` method returns the expected title-cased string. This example is from the documentation for the `word_to_titlecase` method. ```rust assert_eq!("Ο οδυσσέας βασιλιάς της ιθάκης", odysseus_king_of_ithaca.word_to_titlecase()); ``` -------------------------------- ### str::is_empty example Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Example for the is_empty method from Deref, checking if a string has zero length. ```rust let s = ""; assert!(s.is_empty()); let s = "not empty"; assert!(!s.is_empty()); ``` -------------------------------- ### str::len example Source: https://docs.rs/guitarpro/latest/guitarpro/model/mnx/struct.MnxId.html Example for the len method from Deref, showing byte length calculation. ```rust let len = "foo".len(); assert_eq!(3, len); assert_eq!("ƒoo".len(), 4); // fancy f! assert_eq!("ƒoo".chars().count(), 3); ```