Enum source_span::fmt::Style
source · pub enum Style {
Error,
Warning,
Note,
Custom(char, char, Color),
}Expand description
Highlight format description.
Specifies how the highlight should be rendered:
- What character to use to draw the line under one-lined highlights.
1 | fn main() {
2 | println!("Hello World!")
| ++++++++++++++ highlighting this string
3 | }
In this example, the line character is +.
- What boundary marker character to use to point the first and last elements of a multi-line highlight.
1 | fn main() {
| ___________^
2 | | println!("Hello World!")
3 | | }
| |_^ this span covers more than one line
In this example, the boundary marker is ^. The line character is not used.
§Colors
If the colors feature is enabled, it is also possible to set a color to draw the lines.
This will also make the highlights more bright (or bold), along with the line numbers.
Variants§
Error
Red curvy underline.
Warning
Yellow curvy underline.
Note
Blue straight underline.
Custom(char, char, Color)
Custom highlight format.
Specifies the line character, the boundary marker and the color (if the colors feature
is enabled) used to render the highlight.
Implementations§
source§impl Style
impl Style
sourcepub fn new(line: char, marker: char, color: Color) -> Style
pub fn new(line: char, marker: char, color: Color) -> Style
Create a new custom highlight style.
The line character is user to draw the line under the span elements.
The marker character is used to point to the first and last elements of the span when
relevant.
Trait Implementations§
source§impl PartialEq for Style
impl PartialEq for Style
impl Copy for Style
impl Eq for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)