[−][src]Struct show_my_errors::Annotation
Info about annotation. You can create these manually
and then pass to AnnotationList::add
or just use AnnotationList
s helper methods
Fields
header: Option<String>
header
will be shown above error message
text: Option<String>
text
will be shown near annotated fragment.
Note that fragment will be highlighted even if text
is None
.
To disable this, pass a zero length range when creating the annotation.
severity: Severity
Methods
impl Annotation
[src]
pub fn new(
range: Range<usize>,
severity: Severity,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
[src]
range: Range<usize>,
severity: Severity,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
Create new annotation.
Will return Error::InvalidRange
if provided range has start > end
.
You can pass &str
, String
or Option<String>
as header and text arguments.
assert_eq!( Annotation::new(0..5, Severity::Info, "header", "text").unwrap(), Annotation::new( 0..5, Severity::Info, Some("header".into()), Some("text".into()) ).unwrap() ); assert!(Annotation::new(0..5, Severity::Warning, None, None).is_ok()); assert_eq!( Annotation::new(5..0, Severity::Info, "h", "t"), Err(Error::InvalidRange(5, 0)) );
pub fn info(
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
[src]
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
Create a new Severity::Info
annotation
pub fn warning(
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
[src]
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
Create a new Severity::Warning
annotation
pub fn error(
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
[src]
range: Range<usize>,
header: impl AnnotationText,
text: impl AnnotationText
) -> Result<Self>
Create a new Severity::Error
annotation
pub fn range(&self) -> &Range<usize>
[src]
Get annotations range
Trait Implementations
impl Clone for Annotation
[src]
fn clone(&self) -> Annotation
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Annotation
[src]
impl Eq for Annotation
[src]
impl PartialEq<Annotation> for Annotation
[src]
fn eq(&self, other: &Annotation) -> bool
[src]
fn ne(&self, other: &Annotation) -> bool
[src]
impl StructuralEq for Annotation
[src]
impl StructuralPartialEq for Annotation
[src]
Auto Trait Implementations
impl RefUnwindSafe for Annotation
impl Send for Annotation
impl Sync for Annotation
impl Unpin for Annotation
impl UnwindSafe for Annotation
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>,