[−][src]Enum source_span::fmt::Style
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
Red curvy underline.
Yellow curvy underline.
Blue straight underline.
Custom highlight format.
Specifies the line character, the boundary marker and the color (if the
colors
feature is enabled) used to render the highlight.
Methods
impl Style
[src]
#[must_use]
pub const fn new(line: char, marker: char, color: Color) -> Self
[src]
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.
#[must_use]
pub fn line(&self) -> char
[src]
The character used to draw the line under the span elements.
#[must_use]
pub fn marker(&self) -> char
[src]
The character used to point the first and last element of the span when relevant.
#[must_use]
pub fn color(&self) -> Color
[src]
Get the color used to draw the highlight.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,