Token

Enum Token 

Source
#[non_exhaustive]
pub enum Token<'a> {
Show 79 variants Argb(ObjId, Argb), Artist(&'a str), AtBga { id: ObjId, source_bmp: ObjId, trim_top_left: (i16, i16), trim_size: (u16, u16), draw_point: (i16, i16), }, Banner(&'a Path), BackBmp(&'a Path), Base62, BaseBpm(Decimal), Bga { id: ObjId, source_bmp: ObjId, trim_top_left: (i16, i16), trim_bottom_right: (i16, i16), draw_point: (i16, i16), }, Bmp(Option<ObjId>, &'a Path), Bpm(Decimal), BpmChange(ObjId, Decimal), Case(BigUint), Cdda(BigUint), ChangeOption(ObjId, &'a str), CharFile(&'a Path), Charset(&'a str), Comment(&'a str), Def, DefExRank(u64), Difficulty(u8), DivideProp(&'a str), Else, ElseIf(BigUint), Email(&'a str), EndIf, EndRandom, EndSwitch, ExtChr(ExtChrEvent), ExBmp(ObjId, Argb, &'a Path), ExRank(ObjId, JudgeLevel), ExWav { id: ObjId, pan: ExWavPan, volume: ExWavVolume, frequency: Option<ExWavFrequency>, path: &'a Path, }, Genre(&'a str), If(BigUint), LnMode(LnMode), LnObj(ObjId), LnTypeRdm, LnTypeMgq, Maker(&'a str), Materials(&'a Path), MaterialsBmp(&'a Path), MaterialsWav(&'a Path), Message { track: Track, channel: Channel, message: Cow<'a, str>, }, MidiFile(&'a Path), Movie(&'a Path), NotACommand(&'a str), OctFp, Option(&'a str), PathWav(&'a Path), Player(PlayerMode), PlayLevel(u8), PoorBga(PoorMode), Preview(&'a Path), Random(BigUint), Rank(JudgeLevel), Scroll(ObjId, Decimal), Seek(ObjId, Decimal), SetRandom(BigUint), SetSwitch(BigUint), Skip, Speed(ObjId, Decimal), StageFile(&'a Path), Stop(ObjId, Decimal), Stp(StpEvent), SubArtist(&'a str), SubTitle(&'a str), SwBga(ObjId, SwBgaEvent), Switch(BigUint), Text(ObjId, &'a str), Title(&'a str), Total(Decimal), UnknownCommand(&'a str), Url(&'a str), VideoColors(u8), VideoDly(Decimal), VideoFile(&'a Path), VideoFs(Decimal), VolWav(Volume), Wav(ObjId, &'a Path), WavCmd(WavCmdEvent),
}
Expand description

A token content of BMS format.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Argb(ObjId, Argb)

#ARGB[A1-A4] [A],[R],[G],[B] Extended transparent color definition.

  • A1: BGA BASE
  • A2: BGA LAYER
  • A3: BGA LAYER 2
  • A4: BGA POOR
§

Artist(&'a str)

#ARTIST [string]. Defines the artist name of the music.

§

AtBga

#@BGA[01-ZZ] [01-ZZ] [sx] [sy] [w] [h] [dx] [dy]. Defines the image object from trimming the existing image object.

Fields

§id: ObjId

The id of the object to define.

§source_bmp: ObjId

The id of the object to be trimmed.

§trim_top_left: (i16, i16)

The top left point of the trim area in pixels.

§trim_size: (u16, u16)

The size of the trim area in pixels.

§draw_point: (i16, i16)

The top left point to be rendered in pixels.

§

Banner(&'a Path)

#BANNER [filename]. Defines the banner image. This can be used on music select or result view. It should be 300x80.

§

BackBmp(&'a Path)

#BACKBMP [filename]. Defines the background image file of the play view. It should be 640x480. The effect will depend on the skin of the player.

§

Base62

#BASE 62. Declares that the score is using base-62 object id format. If this exists, the score is treated as case-sensitive.

§

BaseBpm(Decimal)

#BASEBPM [f64] is the base BPM. It’s not used in LunaticRave2, replaced by its Hi-Speed Settings.

§

Bga

#BGA[01-ZZ] [01-ZZ] [x1] [y1] [x2] [y2] [dx] [dy]. Defines the image object from trimming the existing image object.

Fields

§id: ObjId

The id of the object to define.

§source_bmp: ObjId

The id of the object to be trimmed.

§trim_top_left: (i16, i16)

The top left point of the trim area in pixels.

§trim_bottom_right: (i16, i16)

The bottom right point of the trim area in pixels.

§draw_point: (i16, i16)

The top left point to be rendered in pixels.

§

Bmp(Option<ObjId>, &'a Path)

#BMP[01-ZZ] [filename]. Defines the background image/movie object. The file specified may be not only BMP format, and also PNG, AVI, MP4, MKV and others. Its size should be less than or equal to 256x256. The black (#000000) pixel in the image will be treated as transparent. When the id 00 is specified, this first field will be None and the image will be shown when the player get mistaken.

§

Bpm(Decimal)

#BPM [f64]. Defines the base Beats-Per-Minute of the score. Defaults to 130, but some players don’t conform to it.

§

BpmChange(ObjId, Decimal)

#BPM[01-ZZ] [f64]. Defines the Beats-Per-Minute change object.

§

Case(BigUint)

#CASE [u32]. Starts a case scope if the integer equals to the generated random number. If there’s no #SKIP command in the scope, the parsing will fallthrough to the next #CASE or #DEF. See also Token::Switch.

§

Cdda(BigUint)

#CDDA [u64]. CD-DA (Compact Disc Digital Audio) extension. CD-DA can be used as BGM (Background Music). In DDR (Dance Dance Revolution), a config of CD-Syncro in SYSTEM OPTION is also applied. This allows the game to play audio directly from a CD drive.

§

ChangeOption(ObjId, &'a str)

#CHANGEOPTION[01-ZZ] [string]. Defines the play option change object. Some players interpret and apply the preferences.

§

CharFile(&'a Path)

#CHARFILE [filename]. The character file similar to pop’n music. It’s filextension is .chp. For now, #CHARFILE is a pomu2 proprietary extension. However, the next-generation version LunaticRave may support #CHARFILE.

§

Charset(&'a str)

#CHARSET [string] Charset declaration. Default is SHIFT-JIS.

§

Comment(&'a str)

#COMMENT [string]. Defines the text which is shown in the music select view. This may or may not be surrounded by double-quotes.

§

Def

#DEF. Starts a case scope if any #CASE had not matched to the generated random number. It must be placed in the end of the switch scope. See also Token::Switch.

§

DefExRank(u64)

#DEFEXRANK [u64] Extended judge rank definition, defined as n% of the original. 100 means NORMAL judge. Overrides #RANK definition.

§

Difficulty(u8)

#DIFFICULTY [1-5]. Defines the difficulty of the score. It can be used to sort the score having the same title.

§

DivideProp(&'a str)

#DIVIDEPROP [string] The resolution of Measure of BMS is specified. Deprecated.

§

Else

#ELSEIF [u32]. Starts an if scope when the preceding #IF had not matched to the generated random number. It must be in an if scope.

§

ElseIf(BigUint)

#ELSEIF [u32]. Starts an if scope when the integer equals to the generated random number. It must be in an if scope. If preceding #IF had matched to the generated, this scope don’t start. Syntax sugar for:

#ELSE
  #IF n
  // ...
  #ENDIF
#ENDIF
§

Email(&'a str)

%EMAIL [string]. The email address of this score file author.

§

EndIf

#ENDIF. Closes the if scope. See Token::If.

§

EndRandom

#ENDRANDOM. Closes the random scope. See Token::Random.

§

EndSwitch

#ENDSW. Closes the random scope. See Token::Switch.

§

ExtChr(ExtChrEvent)

#ExtChr SpriteNum BMPNum startX startY endX endY [offsetX offsetY [x y]] BM98 extended character customization.

§

ExBmp(ObjId, Argb, &'a Path)

#BMP[01-ZZ] [0-255],[0-255],[0-255],[0-255] [filename]. Defines the background image/movie object with the color (alpha, red, green and blue) which will be treated as transparent.

§

ExRank(ObjId, JudgeLevel)

#EXRANK[01-ZZ] [0-3]. Defines the judgement level change object.

§

ExWav

#EXWAV[01-ZZ] [parameter order] [pan or volume or frequency; 1-3] [filename]. Defines the key sound object with the effect of pan, volume and frequency.

Fields

§id: ObjId

The id of the object to define.

§pan: ExWavPan

The pan decay of the sound. Also called volume balance.

§volume: ExWavVolume

The volume decay of the sound.

§frequency: Option<ExWavFrequency>

The pitch frequency of the sound.

§path: &'a Path

The relative file path of the sound.

§

Genre(&'a str)

#GENRE [string]. Defines the genre of the music.

§

If(BigUint)

#IF [u32]. Starts an if scope when the integer equals to the generated random number. This must be placed in a random scope. See also Token::Random.

§

LnMode(LnMode)

#LNMODE [1:LN, 2:CN, 3:HCN] Explicitly specify LN type for this chart.

§

LnObj(ObjId)

#LNOBJ [01-ZZ]. Declares the object as the end of an LN. The preceding object of the declared will be treated as the beginning of an LN.

§

LnTypeRdm

#LNTYPE 1. Declares the LN notation as the RDM type.

§

LnTypeMgq

#LNTYPE 2. Declares the LN notation as the MGQ type.

§

Maker(&'a str)

#MAKER [string]. Defines the author name of the score.

§

Materials(&'a Path)

#MATERIALS [string] Material path definition. Defines the relative path which makes an executable file a starting point. This allows BMS files to reference files in Materials subdirectories using <foldername>filename syntax.

§

MaterialsBmp(&'a Path)

#MATERIALSBMP [filename] Material BMP extension. Deprecated.

§

MaterialsWav(&'a Path)

#MATERIALSWAV [filename] Material WAV extension. Deprecated.

§

Message

#XXXYY:ZZ.... Defines the message which places the object onto the score. XXX is the track, YY is the channel, and ZZ... is the object id sequence.

Fields

§track: Track

The track, or measure, must start from 1. But some player may allow the 0 measure (i.e. Lunatic Rave 2).

§channel: Channel

The channel commonly expresses what the lane be arranged the note to.

§message: Cow<'a, str>

The message to the channel.

§

MidiFile(&'a Path)

#MIDIFILE [filename]. Defines the MIDI file as the BGM. This is a minor command extension that allows MIDI files to be used as background music. Deprecated - Some players may not support this feature.

§

Movie(&'a Path)

#MOVIE [filename] DXEmu extension, defines global video file.

  • Video starts from #000.
  • Priority rules:
    • If #xxx04 is an image file (BMP, PNG, etc.), #MOVIE has priority.
    • If both #xxx04 and #MOVIE are video files, #xxx04 has priority.
  • No loop, stays on last frame after playback.
  • Audio track in video is not played.
§

NotACommand(&'a str)

Non-empty lines that not starts in '#' in bms file.

§

OctFp

#OCT/FP. Declares the score as the octave mode. This is a minor command extension that enables octave mode for the chart. In octave mode, the chart may have different note arrangements or gameplay mechanics.

§

Option(&'a str)

#OPTION [string]. Defines the play option of the score. Some players interpret and apply the preferences.

§

PathWav(&'a Path)

#PATH_WAV [string]. Defines the root path of Token::Wav paths. This should be used only for tests.

§

Player(PlayerMode)

#PLAYER [1-4]. Defines the play style of the score.

§

PlayLevel(u8)

#PLAYLEVEL [integer]. Defines the difficulty level of the score. This can be used on music select view.

§

PoorBga(PoorMode)

#POORBGA [0-2]. Defines the display mode of the POOR BGA.

§

Preview(&'a Path)

#PREVIEW [filename] Preview audio file for music selection.

§

Random(BigUint)

#RANDOM [u32]. Starts a random scope which can contain only #IF-#ENDIF scopes. The random scope must close with #ENDRANDOM. A random integer from 1 to the integer will be generated when parsing the score. Then if the integer of #IF equals to the random integer, the commands in an if scope will be parsed, otherwise all command in it will be ignored. Any command except #IF and #ENDIF must not be included in the scope, but some players allow it.

§

Rank(JudgeLevel)

#RANK [0-3]. Defines the judgement level.

§

Scroll(ObjId, Decimal)

#SCROLL[01-ZZ] [f64]. Defines the scroll speed change object. It changes relative falling speed of notes with keeping BPM. For example, if applying 2.0, the scroll speed will become double.

§

Seek(ObjId, Decimal)

#SEEK[01-ZZ] [f64] Video seek extension. Defines a video seek event that allows jumping to specific time positions in video files. This is a minor command extension for advanced video control.

§

SetRandom(BigUint)

#SETRANDOM [u32]. Starts a random scope but the integer will be used as the generated random number. It should be used only for tests.

§

SetSwitch(BigUint)

#SETSWITCH [u32]. Starts a switch scope but the integer will be used as the generated random number. It should be used only for tests.

§

Skip

#SKIP. Escapes the current switch scope. It is often used in the end of every case scope.

§

Speed(ObjId, Decimal)

#SPEED[01-ZZ] [f64]. Defines the spacing change object. It changes relative spacing of notes with linear interpolation. For example, if playing score between the objects 1.0 and 2.0, the spaces of notes will increase at the certain rate until the 2.0 object.

§

StageFile(&'a Path)

#STAGEFILE [filename]. Defines the splashscreen image. It should be 640x480.

§

Stop(ObjId, Decimal)

#STOP[01-ZZ] [0-4294967295]. Defines the stop object. The scroll will stop the beats of the integer divided by 192. A beat length depends on the current BPM. If there are other objects on same time, the stop object must be evaluated at last.

§

Stp(StpEvent)

#STP xxx.yyy zzzz bemaniaDX STOP sequence.

§

SubArtist(&'a str)

#SUBARTIST [string]. Defines the sub-artist name of the music.

§

SubTitle(&'a str)

#SUBTITLE [string]. Defines the subtitle of the music.

§

SwBga(ObjId, SwBgaEvent)

#SWBGA[01-ZZ] fr:time:line:loop:a,r,g,b pattern Key Bind Layer Animation.

§

Switch(BigUint)

#SWITCH [u32]. Starts a switch scope which can contain only #CASE or #DEF scopes. The switch scope must close with #ENDSW. A random integer from 1 to the integer will be generated when parsing the score. Then if the integer of #CASE equals to the random integer, the commands in a case scope will be parsed, otherwise all command in it will be ignored. Any command except #CASE and #DEF must not be included in the scope, but some players allow it.

§

Text(ObjId, &'a str)

#TEXT[01-ZZ] string. Defines the text object.

§

Title(&'a str)

#TITLE [string]. Defines the title of the music.

§

Total(Decimal)

#TOTAL [f64]. Defines the total gauge percentage when all notes is got as PERFECT.

§

UnknownCommand(&'a str)

Unknown Part. Includes all the line that not be parsed.

§

Url(&'a str)

%URL [string]. The url of this score file.

§

VideoColors(u8)

#VIDEOCOLORS [u8] Video color depth, default 16Bit. Defines the color depth for video playback. Common values are 16, 24, or 32 bits. This affects the quality and performance of video rendering.

§

VideoDly(Decimal)

#VIDEODLY [f64] Video delay extension. Defines a delay in seconds before video playback starts. This is useful for synchronizing video with audio or other game elements.

§

VideoFile(&'a Path)

#VIDEOFILE [filename] / #MOVIE [filename]. Defines the background movie file. The audio track in the movie file should not be played. The play should start from the track 000.

§

VideoFs(Decimal)

#VIDEOF/S [f64] Video file frame rate. Defines the frame rate for video playback in frames per second (FPS). This affects the smoothness and timing of video playback.

§

VolWav(Volume)

#VOLWAV [0-255]. Defines the relative volume percentage of the sound in the score.

§

Wav(ObjId, &'a Path)

#WAV[01-ZZ] [filename]. Defines the key sound object. When same id multiple objects ring at same time, it must be played only one. The file specified may be not only WAV format, and also OGG, MP3 and others.

§

WavCmd(WavCmdEvent)

#WAVCMD [param] [wav-index] [value] MacBeat extension, pseudo-MOD effect.

Implementations§

Source§

impl<'a> Token<'a>

Source

pub const fn is_control_flow_token(&self) -> bool

Checks if a token is a control flow token.

Trait Implementations§

Source§

impl<'a> Clone for Token<'a>

Source§

fn clone(&self) -> Token<'a>

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<'a> Debug for Token<'a>

Source§

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

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

impl Display for Token<'_>

Source§

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

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

impl<'a> Hash for Token<'a>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for Token<'a>

Source§

fn eq(&self, other: &Token<'a>) -> 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<'a> Serialize for Token<'a>

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<'a> Eq for Token<'a>

Source§

impl<'a> StructuralPartialEq for Token<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Token<'a>

§

impl<'a> RefUnwindSafe for Token<'a>

§

impl<'a> Send for Token<'a>

§

impl<'a> Sync for Token<'a>

§

impl<'a> Unpin for Token<'a>

§

impl<'a> UnwindSafe for Token<'a>

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> Fmt for T
where T: Display,

Source§

fn fg<C>(self, color: C) -> Foreground<Self>
where C: Into<Option<Color>>, Self: Display,

Give this value the specified foreground colour.
Source§

fn bg<C>(self, color: C) -> Background<Self>
where C: Into<Option<Color>>, Self: Display,

Give this value the specified background colour.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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