pub struct SourceMap { /* private fields */ }__utils only.Expand description
The interner for spans.
As most spans are simply stored, we store them as interned form.
- Each ast node only stores pointer to actual data (BytePos).
- The pointers (BytePos) can be converted to file name, line and column using this struct.
Note
This struct should be shared. swc_common uses crate::sync::Lrc, which is
std::rc::Rc or std::sync::Arc, depending on the compile option, for this
purpose.
Note for bundler authors
If you are bundling modules, you should share this struct while parsing modules. Otherwise, you have to implement a code generator which accepts multiple SourceMap.
Implementations
sourceimpl SourceMap
impl SourceMap
pub fn new(path_mapping: FilePathMapping) -> SourceMap
__common only.pub fn with_file_loader(
file_loader: Box<dyn FileLoader + Sync + Send + 'static, Global>,
path_mapping: FilePathMapping
) -> SourceMap
__common only.pub fn path_mapping(&self) -> &FilePathMapping
__common only.pub fn file_exists(&self, path: &Path) -> bool
__common only.pub fn load_file(&self, path: &Path) -> Result<Arc<SourceFile>, Error>
__common only.pub fn files(
&self
) -> MappedMutexGuard<'_, RawMutex, Vec<Arc<SourceFile>, Global>>
__common only.pub fn source_file_by_stable_id(
&self,
stable_id: StableSourceFileId
) -> Option<Arc<SourceFile>>
__common only.sourcepub fn new_source_file(&self, filename: FileName, src: String) -> Arc<SourceFile>
Available on crate feature __common only.
pub fn new_source_file(&self, filename: FileName, src: String) -> Arc<SourceFile>
__common only.Creates a new source_file. This does not ensure that only one SourceFile exists per file name.
pub fn mk_substr_filename(&self, sp: Span) -> String
__common only.pub fn doctest_offset_line(&self, orig: usize) -> usize
__common only.sourcepub fn lookup_char_pos(&self, pos: BytePos) -> Loc
Available on crate feature __common only.
pub fn lookup_char_pos(&self, pos: BytePos) -> Loc
__common only.Lookup source information about a BytePos
sourcepub fn lookup_line(
&self,
pos: BytePos
) -> Result<SourceFileAndLine, Arc<SourceFile>>
Available on crate feature __common only.
pub fn lookup_line(
&self,
pos: BytePos
) -> Result<SourceFileAndLine, Arc<SourceFile>>
__common only.If the relevant source_file is empty, we don’t return a line number.
pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt
__common only.sourcepub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>
Available on crate feature __common only.
pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>
__common only.Returns Some(span), a union of the lhs and rhs span. The lhs must
precede the rhs. If there are gaps between lhs and rhs, the
resulting union will cross these gaps. For this to work, the spans
have to be:
- the ctxt of both spans much match
- the lhs span needs to end on the same line the rhs span begins
- the lhs span must start at or before the rhs span
pub fn span_to_string(&self, sp: Span) -> String
__common only.pub fn span_to_filename(&self, sp: Span) -> FileName
__common only.pub fn span_to_unmapped_path(&self, sp: Span) -> FileName
__common only.pub fn is_multiline(&self, sp: Span) -> bool
__common only.pub fn span_to_lines(&self, sp: Span) -> Result<FileLines, SpanLinesError>
__common only.sourcepub fn with_snippet_of_span<F, Ret>(
&self,
sp: Span,
op: F
) -> Result<Ret, SpanSnippetError> where
F: FnOnce(&str) -> Ret,
Available on crate feature __common only.
pub fn with_snippet_of_span<F, Ret>(
&self,
sp: Span,
op: F
) -> Result<Ret, SpanSnippetError> where
F: FnOnce(&str) -> Ret,
__common only.Calls op with the source code located at sp.
pub fn span_to_margin(&self, sp: Span) -> Option<usize>
__common only.sourcepub fn with_span_to_prev_source<F, Ret>(
&self,
sp: Span,
op: F
) -> Result<Ret, SpanSnippetError> where
F: FnOnce(&str) -> Ret,
Available on crate feature __common only.
pub fn with_span_to_prev_source<F, Ret>(
&self,
sp: Span,
op: F
) -> Result<Ret, SpanSnippetError> where
F: FnOnce(&str) -> Ret,
__common only.Calls the given closure with the source snippet before the given Span
sourcepub fn span_to_prev_source(&self, sp: Span) -> Result<String, SpanSnippetError>
Available on crate feature __common only.
pub fn span_to_prev_source(&self, sp: Span) -> Result<String, SpanSnippetError>
__common only.Return the source snippet as String before the given Span
sourcepub fn with_span_to_next_source<F, Ret>(
&self,
sp: Span,
op: F
) -> Result<Ret, SpanSnippetError> where
F: FnOnce(&str) -> Ret,
Available on crate feature __common only.
pub fn with_span_to_next_source<F, Ret>(
&self,
sp: Span,
op: F
) -> Result<Ret, SpanSnippetError> where
F: FnOnce(&str) -> Ret,
__common only.Calls the given closure with the source snippet after the given Span
sourcepub fn span_to_next_source(&self, sp: Span) -> Result<String, SpanSnippetError>
Available on crate feature __common only.
pub fn span_to_next_source(&self, sp: Span) -> Result<String, SpanSnippetError>
__common only.Return the source snippet as String after the given Span
sourcepub fn span_extend_to_prev_char(&self, sp: Span, c: char) -> Span
Available on crate feature __common only.
pub fn span_extend_to_prev_char(&self, sp: Span, c: char) -> Span
__common only.Extend the given Span to just after the previous occurrence of c.
Return the same span if no character could be found or if an error
occurred while retrieving the code snippet.
sourcepub fn span_extend_to_prev_str(
&self,
sp: Span,
pat: &str,
accept_newlines: bool
) -> Span
Available on crate feature __common only.
pub fn span_extend_to_prev_str(
&self,
sp: Span,
pat: &str,
accept_newlines: bool
) -> Span
__common only.Extend the given Span to just after the previous occurrence of pat
when surrounded by whitespace. Return the same span if no character
could be found or if an error occurred while retrieving the code
snippet.
sourcepub fn span_extend_to_next_char(&self, sp: Span, c: char) -> Span
Available on crate feature __common only.
pub fn span_extend_to_next_char(&self, sp: Span, c: char) -> Span
__common only.Extend the given Span to just after the next occurrence of c.
Return the same span if no character could be found or if an error
occurred while retrieving the code snippet.
sourcepub fn span_extend_to_next_str(
&self,
sp: Span,
pat: &str,
accept_newlines: bool
) -> Span
Available on crate feature __common only.
pub fn span_extend_to_next_str(
&self,
sp: Span,
pat: &str,
accept_newlines: bool
) -> Span
__common only.Extend the given Span to just after the next occurrence of pat
when surrounded by whitespace. Return the same span if no character
could be found or if an error occurred while retrieving the code
snippet.
sourcepub fn span_until_char(&self, sp: Span, c: char) -> Span
Available on crate feature __common only.
pub fn span_until_char(&self, sp: Span, c: char) -> Span
__common only.Given a Span, try to get a shorter span ending before the first
occurrence of c char
Notes
This method returns a dummy span for a dummy span.
sourcepub fn span_through_char(&self, sp: Span, c: char) -> Span
Available on crate feature __common only.
pub fn span_through_char(&self, sp: Span, c: char) -> Span
__common only.Given a Span, try to get a shorter span ending just after the first
occurrence of char c.
Notes
This method returns a dummy span for a dummy span.
sourcepub fn span_until_non_whitespace(&self, sp: Span) -> Span
Available on crate feature __common only.
pub fn span_until_non_whitespace(&self, sp: Span) -> Span
__common only.Given a Span, get a new Span covering the first token and all its
trailing whitespace or the original Span.
If sp points to "let mut x", then a span pointing at "let " will
be returned.
sourcepub fn span_until_whitespace(&self, sp: Span) -> Span
Available on crate feature __common only.
pub fn span_until_whitespace(&self, sp: Span) -> Span
__common only.Given a Span, get a new Span covering the first token without its
trailing whitespace or the original Span in case of error.
If sp points to "let mut x", then a span pointing at "let" will be
returned.
sourcepub fn span_take_while<P>(&self, sp: Span, predicate: P) -> Span where
P: for<'r> FnMut(&'r char) -> bool,
Available on crate feature __common only.
pub fn span_take_while<P>(&self, sp: Span, predicate: P) -> Span where
P: for<'r> FnMut(&'r char) -> bool,
__common only.Given a Span, get a shorter one until predicate yields false.
pub fn def_span(&self, sp: Span) -> Span
__common only.sourcepub fn start_point(&self, sp: Span) -> Span
Available on crate feature __common only.
pub fn start_point(&self, sp: Span) -> Span
__common only.Returns a new span representing just the start-point of this span
sourcepub fn end_point(&self, sp: Span) -> Span
Available on crate feature __common only.
pub fn end_point(&self, sp: Span) -> Span
__common only.Returns a new span representing just the end-point of this span
sourcepub fn next_point(&self, sp: Span) -> Span
Available on crate feature __common only.
pub fn next_point(&self, sp: Span) -> Span
__common only.Returns a new span representing the next character after the end-point of this span
pub fn get_source_file(&self, filename: &FileName) -> Option<Arc<SourceFile>>
__common only.sourcepub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos
Available on crate feature __common only.
pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos
__common only.For a global BytePos compute the local offset within the containing SourceFile
pub fn count_lines(&self) -> usize
__common only.pub fn generate_fn_name_span(&self, span: Span) -> Option<Span>
__common only.sourcepub fn generate_local_type_param_snippet(
&self,
span: Span
) -> Option<(Span, String)>
Available on crate feature __common only.
pub fn generate_local_type_param_snippet(
&self,
span: Span
) -> Option<(Span, String)>
__common only.Take the span of a type parameter in a function signature and try to generate a span for the function name (with generics) and a new snippet for this span with the pointed type parameter as a new local type parameter.
For instance:
// Given span
fn my_function(param: T)
// ^ Original span
// Result
fn my_function(param: T)
// ^^^^^^^^^^^ Generated span with snippet `my_function<T>`Attention: The method used is very fragile since it essentially duplicates the work of the parser. If you need to use this function or something similar, please consider updating the source_map functions and this function to something more robust.
sourcepub fn build_source_map(
&self,
mappings: &mut Vec<(BytePos, LineCol), Global>
) -> SourceMap
Available on crate feature __common only.
pub fn build_source_map(
&self,
mappings: &mut Vec<(BytePos, LineCol), Global>
) -> SourceMap
__common only.sourcepub fn build_source_map_from(
&self,
mappings: &mut Vec<(BytePos, LineCol), Global>,
orig: Option<&SourceMap>
) -> SourceMap
Available on crate feature __common only.
pub fn build_source_map_from(
&self,
mappings: &mut Vec<(BytePos, LineCol), Global>,
orig: Option<&SourceMap>
) -> SourceMap
__common only.Creates a .map file.
pub fn build_source_map_with_config(
&self,
mappings: &mut Vec<(BytePos, LineCol), Global>,
orig: Option<&SourceMap>,
config: impl SourceMapGenConfig
) -> SourceMap
__common only.Trait Implementations
sourceimpl SourceMapper for SourceMap
impl SourceMapper for SourceMap
sourcefn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError>
fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError>
Return the source snippet as String corresponding to the given Span
fn lookup_char_pos(&self, pos: BytePos) -> Loc
fn span_to_lines(&self, sp: Span) -> Result<FileLines, SpanLinesError>
fn span_to_string(&self, sp: Span) -> String
fn span_to_filename(&self, sp: Span) -> FileName
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>
fn call_span_if_macro(&self, sp: Span) -> Span
fn doctest_offset_line(&self, line: usize) -> usize
sourceimpl SourceMapperExt for SourceMap
impl SourceMapperExt for SourceMap
fn get_code_map(&self) -> &dyn SourceMapper
fn is_on_same_line(&self, _lo: BytePos, _hi: BytePos) -> bool
fn should_write_separating_line_terminator<P, N>(
&self,
prev: Option<P>,
next: Option<N>,
format: ListFormat
) -> bool where
P: Spanned,
N: Spanned,
fn should_write_leading_line_terminator<N>(
&self,
parent_node: Span,
children: &[N],
format: ListFormat
) -> bool where
N: Spanned,
fn should_write_closing_line_terminator<N>(
&self,
parent_node: Span,
children: &[N],
format: ListFormat
) -> bool where
N: Spanned,
Auto Trait Implementations
impl !RefUnwindSafe for SourceMap
impl Send for SourceMap
impl Sync for SourceMap
impl Unpin for SourceMap
impl !UnwindSafe for SourceMap
Blanket Implementations
impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<D> OwoColorize for D
impl<D> OwoColorize for D
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self> where
C: Color,
Set the foreground color generically Read more
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self> where
C: Color,
Set the background color generically. Read more
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
fn black(&'a self) -> FgColorDisplay<'a, Black, Self>
Change the foreground color to black
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
fn on_black(&'a self) -> BgColorDisplay<'a, Black, Self>
Change the background color to black
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
fn red(&'a self) -> FgColorDisplay<'a, Red, Self>
Change the foreground color to red
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
fn on_red(&'a self) -> BgColorDisplay<'a, Red, Self>
Change the background color to red
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
fn green(&'a self) -> FgColorDisplay<'a, Green, Self>
Change the foreground color to green
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
fn on_green(&'a self) -> BgColorDisplay<'a, Green, Self>
Change the background color to green
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
fn yellow(&'a self) -> FgColorDisplay<'a, Yellow, Self>
Change the foreground color to yellow
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow(&'a self) -> BgColorDisplay<'a, Yellow, Self>
Change the background color to yellow
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
fn blue(&'a self) -> FgColorDisplay<'a, Blue, Self>
Change the foreground color to blue
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
fn on_blue(&'a self) -> BgColorDisplay<'a, Blue, Self>
Change the background color to blue
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to magenta
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to magenta
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn purple(&'a self) -> FgColorDisplay<'a, Magenta, Self>
Change the foreground color to purple
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple(&'a self) -> BgColorDisplay<'a, Magenta, Self>
Change the background color to purple
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
fn cyan(&'a self) -> FgColorDisplay<'a, Cyan, Self>
Change the foreground color to cyan
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
fn on_cyan(&'a self) -> BgColorDisplay<'a, Cyan, Self>
Change the background color to cyan
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
fn white(&'a self) -> FgColorDisplay<'a, White, Self>
Change the foreground color to white
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
fn on_white(&'a self) -> BgColorDisplay<'a, White, Self>
Change the background color to white
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color(&'a self) -> FgColorDisplay<'a, Default, Self>
Change the foreground color to the terminal default
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color(&'a self) -> BgColorDisplay<'a, Default, Self>
Change the background color to the terminal default
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
Change the foreground color to bright black
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
Change the background color to bright black
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
Change the foreground color to bright red
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
Change the background color to bright red
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
Change the foreground color to bright green
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
Change the background color to bright green
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
Change the foreground color to bright yellow
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
Change the background color to bright yellow
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
Change the foreground color to bright blue
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
Change the background color to bright blue
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright magenta
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright magenta
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
Change the foreground color to bright purple
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
Change the background color to bright purple
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
Change the foreground color to bright cyan
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
Change the background color to bright cyan
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
Change the foreground color to bright white
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
Change the background color to bright white
fn bold(&'a self) -> BoldDisplay<'a, Self>
fn bold(&'a self) -> BoldDisplay<'a, Self>
Make the text bold
fn dimmed(&'a self) -> DimDisplay<'a, Self>
fn dimmed(&'a self) -> DimDisplay<'a, Self>
Make the text dim
fn italic(&'a self) -> ItalicDisplay<'a, Self>
fn italic(&'a self) -> ItalicDisplay<'a, Self>
Make the text italicized
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
fn underline(&'a self) -> UnderlineDisplay<'a, Self>
Make the text italicized
fn blink(&'a self) -> BlinkDisplay<'a, Self>
fn blink(&'a self) -> BlinkDisplay<'a, Self>
Make the text blink
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast(&'a self) -> BlinkFastDisplay<'a, Self>
Make the text blink (but fast!)
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
fn reversed(&'a self) -> ReversedDisplay<'a, Self>
Swap the foreground and background colors
Hide the text
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough(&'a self) -> StrikeThroughDisplay<'a, Self>
Cross out the text
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self> where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more