Notes

Struct Notes 

Source
pub struct Notes<T> {
    pub wav_path_root: Option<PathBuf>,
    pub wav_files: HashMap<ObjId, PathBuf>,
    pub midi_file: Option<PathBuf>,
    pub materials_wav: Vec<PathBuf>,
    pub bgm_volume_changes: BTreeMap<ObjTime, BgmVolumeObj>,
    pub key_volume_changes: BTreeMap<ObjTime, KeyVolumeObj>,
    pub seek_events: BTreeMap<ObjTime, SeekObj>,
    pub text_events: BTreeMap<ObjTime, TextObj>,
    pub judge_events: BTreeMap<ObjTime, JudgeObj>,
    pub bga_keybound_events: BTreeMap<ObjTime, BgaKeyboundObj>,
    pub option_events: BTreeMap<ObjTime, OptionObj>,
    /* private fields */
}
Expand description

The playable objects set for querying by lane or time.

Fields§

§wav_path_root: Option<PathBuf>

The path to override the base path of the WAV file path. This allows WAV files to be referenced relative to a different directory.

§wav_files: HashMap<ObjId, PathBuf>

The WAV file paths corresponding to the id of the note object.

§midi_file: Option<PathBuf>

The path of MIDI file, which is played as BGM while playing the score.

§materials_wav: Vec<PathBuf>

Material WAV file paths. #MATERIALSWAV

§bgm_volume_changes: BTreeMap<ObjTime, BgmVolumeObj>

BGM volume change events, indexed by time. #97

§key_volume_changes: BTreeMap<ObjTime, KeyVolumeObj>

KEY volume change events, indexed by time. #98

§seek_events: BTreeMap<ObjTime, SeekObj>

Seek events, indexed by time. #05

§text_events: BTreeMap<ObjTime, TextObj>

Text events, indexed by time. #99

§judge_events: BTreeMap<ObjTime, JudgeObj>

Judge events, indexed by time. #A0

§bga_keybound_events: BTreeMap<ObjTime, BgaKeyboundObj>

BGA keybound events, indexed by time. #A5

§option_events: BTreeMap<ObjTime, OptionObj>

Option events, indexed by time. #A6

Implementations§

Source§

impl<T> Notes<T>

Source

pub fn is_empty(&self) -> bool

Checks whether there is no valid notes.

Source

pub fn into_all_notes(self) -> Vec<WavObj>

Converts into the notes.

Source

pub fn all_notes(&self) -> impl Iterator<Item = &WavObj>

Returns the iterator having all of the notes sorted by time.

Source

pub fn all_entries(&self) -> impl Iterator<Item = (WavObjArenaIndex, &WavObj)>

Returns the iterator having all of the notes and its index sorted by time.

Source

pub fn playables(&self) -> impl Iterator<Item = &WavObj>
where T: KeyLayoutMapper,

Returns all the playable notes in the score.

Source

pub fn displayables(&self) -> impl Iterator<Item = &WavObj>
where T: KeyLayoutMapper,

Returns all the displayable notes in the score.

Source

pub fn bgms(&self) -> impl Iterator<Item = &WavObj>
where T: KeyLayoutMapper,

Returns all the bgms in the score.

Source

pub fn notes_on( &self, channel_id: NoteChannelId, ) -> impl Iterator<Item = (WavObjArenaIndex, &WavObj)>
where T: KeyLayoutMapper,

Retrieves notes on the specified channel id by the key mapping T.

Source

pub fn notes_in<R: RangeBounds<ObjTime>>( &self, time_span: R, ) -> impl DoubleEndedIterator<Item = (WavObjArenaIndex, &WavObj)>

Retrieves notes in the specified time span.

Source

pub fn next_obj_by_key( &self, channel_id: NoteChannelId, time: ObjTime, ) -> Option<&WavObj>

Finds next object on the key Key from the time ObjTime.

Source

pub fn last_obj_time(&self) -> Option<ObjTime>

Gets the latest starting time of all notes.

Source

pub fn last_playable_time(&self) -> Option<ObjTime>
where T: KeyLayoutMapper,

Gets the time of last playable object.

Source

pub fn last_bgm_time(&self) -> Option<ObjTime>
where T: KeyLayoutMapper,

Gets the time of last BGM object.

You can’t use this to find the length of music. Because this doesn’t consider that the length of sound. And visible notes may ring after all BGMs.

Source§

impl<T> Notes<T>

Source

pub fn push_note(&mut self, note: WavObj)

Adds the new note object to the notes.

Source

pub fn pop_note(&mut self) -> Option<WavObj>

Removes the latest note from the notes.

Source

pub fn remove_note(&mut self, wav_id: ObjId) -> Vec<WavObj>
where T: KeyLayoutMapper,

Removes notes belonging to the wav id.

Source

pub fn pop_by_idx(&mut self, idx: WavObjArenaIndex) -> Option<WavObj>

Removes a note of the specified index idx.

Source

pub fn pop_latest_of(&mut self, wav_id: ObjId) -> Option<WavObj>
where T: KeyLayoutMapper,

Removes the latest note using the wav of wav_id.

Source

pub fn push_bgm(&mut self, time: ObjTime, wav_id: ObjId)
where T: KeyLayoutMapper,

Adds the BGM (auto-played) note of wav_id at time.

Source

pub fn push_wav<P: Into<PathBuf>>( &mut self, wav_id: ObjId, path: P, ) -> Option<PathBuf>

Links the wav file path to the object id wav_id. Then returns the old path if existed.

Source

pub fn remove_wav(&mut self, wav_id: &ObjId) -> Option<PathBuf>

Unlinks the wav file path from the object id wav_id, and return the path if existed.

Source

pub fn retain_notes<F: FnMut(&WavObj) -> bool>(&mut self, cond: F)
where T: KeyLayoutMapper,

Retains note objects with the condition cond. It keeps only the WavObjs which cond returned true.

Source

pub fn dup_note_into(&mut self, src: ObjId, at: ObjTime, dst: NoteChannelId)

Duplicates the object with id src at the time at into the channel of id dst.

Source

pub fn push_bgm_volume_change( &mut self, volume_obj: BgmVolumeObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new BGM volume change object to the notes.

Source

pub fn push_key_volume_change( &mut self, volume_obj: KeyVolumeObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new KEY volume change object to the notes.

Source

pub fn push_seek_event( &mut self, seek_obj: SeekObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new seek object to the notes.

Source

pub fn push_text_event( &mut self, text_obj: TextObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new text object to the notes.

Source

pub fn push_judge_event( &mut self, judge_obj: JudgeObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new judge object to the notes.

Source

pub fn push_bga_keybound_event( &mut self, keybound_obj: BgaKeyboundObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new BGA keybound object to the notes.

Source

pub fn push_option_event( &mut self, option_obj: OptionObj, prompt_handler: &mut impl PromptHandler, ) -> Result<(), ParseWarning>

Adds a new option object to the notes.

Source§

impl<T> Notes<T>

Source

pub fn change_note_channel<I>(&mut self, targets: I, dst: NoteChannelId)
where T: KeyLayoutMapper, I: IntoIterator<Item = WavObjArenaIndex>,

Changes the channel of notes target in time_span into another channel dst.

Source

pub fn change_note_time( &mut self, target: WavObjArenaIndex, new_time: ObjTime, ) -> Option<ObjTime>

Changes the specified object target’s offset time into new_time.

Trait Implementations§

Source§

impl<T: Clone> Clone for Notes<T>

Source§

fn clone(&self) -> Notes<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Notes<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Default for Notes<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, T> Deserialize<'de> for Notes<T>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: PartialEq> PartialEq for Notes<T>

Source§

fn eq(&self, other: &Notes<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Serialize for Notes<T>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Eq> Eq for Notes<T>

Source§

impl<T> StructuralPartialEq for Notes<T>

Auto Trait Implementations§

§

impl<T> Freeze for Notes<T>

§

impl<T> RefUnwindSafe for Notes<T>

§

impl<T> Send for Notes<T>

§

impl<T> Sync for Notes<T>

§

impl<T> Unpin for Notes<T>

§

impl<T> UnwindSafe for Notes<T>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Paint for T
where T: ?Sized,

Source§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

§Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
Source§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
Source§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
Source§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
Source§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
Source§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
Source§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
Source§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
Source§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
Source§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
Source§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
Source§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
Source§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
Source§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
Source§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
Source§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
Source§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
Source§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
Source§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
Source§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
Source§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

§Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
Source§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
Source§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
Source§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
Source§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
Source§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
Source§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
Source§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
Source§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
Source§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
Source§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
Source§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
Source§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
Source§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
Source§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
Source§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
Source§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
Source§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
Source§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
Source§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
Source§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling Attribute value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

§Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
Source§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
Source§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
Source§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
Source§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
Source§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
Source§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
Source§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
Source§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi Quirk value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

§Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
Source§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
Source§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
Source§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
Source§

fn clear(&self) -> Painted<&T>

👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear(). The clear() method will be removed in a future release.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
Source§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
Source§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
Source§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
Source§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the Condition value applies. Replaces any previous condition.

See the crate level docs for more details.

§Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new Painted with a default Style. Read more
Source§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T> SourceRangeMixinExt for T

Source§

fn into_wrapper<W>( self, wrapper: &SourceRangeMixin<W>, ) -> SourceRangeMixin<Self>
where Self: Sized,

Creates a new SourceRangeMixin with the same span as a wrapper.
Source§

fn into_wrapper_range(self, range: Range<usize>) -> SourceRangeMixin<Self>
where Self: Sized,

Creates a new SourceRangeMixin with a given range.
Source§

fn into_wrapper_span(self, span: (usize, usize)) -> SourceRangeMixin<Self>
where Self: Sized,

Creates a new SourceRangeMixin with a given (start, end) span.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,