[−][src]Struct show_my_errors::AnnotationList
List of annotations applied to some input string. Doesn't owns string, so has a limited lifetime.
Methods
impl<'a> AnnotationList<'a>
[src]
pub fn new(filename: impl AsRef<str>, string: &'a str) -> Self
[src]
Create an annotation list from string. filename
is used only to format messages, so
corresponding file doesn't need to exist.
pub fn add(&mut self, annotation: Annotation) -> Result<&mut Self>
[src]
Add an Annotation
to list. You may also use .info()
,
.warning()
and .error()
methods.
pub fn info(
&mut self,
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<&mut Self>
[src]
&mut self,
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<&mut Self>
Add an Severity::Info
annotation to list. See Annotation::new
docs for details
pub fn warning(
&mut self,
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<&mut Self>
[src]
&mut self,
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<&mut Self>
Add an Severity::Warning
annotation to list. See Annotation::new
docs for details
pub fn error(
&mut self,
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<&mut Self>
[src]
&mut self,
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<&mut Self>
Add an Severity::Error
annotation to list. See Annotation::new
docs for details
pub fn show<W: Write + WriteColor>(
&self,
stream: W,
stylesheet: &Stylesheet
) -> Result<()>
[src]
&self,
stream: W,
stylesheet: &Stylesheet
) -> Result<()>
Print an error message to stream using given stylesheet. If your stream implements
Write
, but not WriteColor
, consider wrapping
it into termcolor::Ansi
or termcolor::NoColor
.
This method uses no buffering, so you probably want to pass termcolor::Buffer
to it
rather than raw stream.
If you want to just print message to stdout/stderr, consider using
.print_stdout()
or
.print_stderr()
instead.
pub fn show_stdout(&self, stylesheet: &Stylesheet) -> Result<()>
[src]
Print error message to stdout. Output will be colorized if stdout is a TTY
pub fn show_stderr(&self, stylesheet: &Stylesheet) -> Result<()>
[src]
Print error message to stderr. Output will be colorized if stderr is a TTY
pub fn to_bytes(&self) -> Result<Vec<u8>>
[src]
"Print" monochrome message to Vec<u8>
pub fn to_ansi_bytes(&self, stylesheet: &Stylesheet) -> Result<Vec<u8>>
[src]
"Print" message to Vec<u8>
, colorizing it using ANSI escape codes
pub fn to_string(&self) -> Result<String>
[src]
pub fn to_ansi_string(&self, stylesheet: &Stylesheet) -> Result<String>
[src]
Trait Implementations
impl<'a> Debug for AnnotationList<'a>
[src]
impl<'a> Eq for AnnotationList<'a>
[src]
impl<'a> PartialEq<AnnotationList<'a>> for AnnotationList<'a>
[src]
fn eq(&self, other: &AnnotationList<'a>) -> bool
[src]
fn ne(&self, other: &AnnotationList<'a>) -> bool
[src]
impl<'a> StructuralEq for AnnotationList<'a>
[src]
impl<'a> StructuralPartialEq for AnnotationList<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for AnnotationList<'a>
impl<'a> Send for AnnotationList<'a>
impl<'a> Sync for AnnotationList<'a>
impl<'a> Unpin for AnnotationList<'a>
impl<'a> UnwindSafe for AnnotationList<'a>
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, 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>,