pub struct Diagnostic { /* private fields */ }
Expand description
Represents a diagnostic originated from a compilation unit.
Arguments are formatted using integer keys counted from 1 (one).
Implementations§
Source§impl Diagnostic
impl Diagnostic
pub fn new_syntax_error( location: &Location, kind: DiagnosticKind, arguments: Vec<Rc<dyn DiagnosticArgument>>, ) -> Self
pub fn new_verify_error( location: &Location, kind: DiagnosticKind, arguments: Vec<Rc<dyn DiagnosticArgument>>, ) -> Self
pub fn new_warning( location: &Location, kind: DiagnosticKind, arguments: Vec<Rc<dyn DiagnosticArgument>>, ) -> Self
pub fn location(&self) -> Location
pub fn kind(&self) -> DiagnosticKind
pub fn is_warning(&self) -> bool
pub fn is_error(&self) -> bool
pub fn is_syntax_error(&self) -> bool
pub fn is_verify_error(&self) -> bool
pub fn arguments(&self) -> Vec<Rc<dyn DiagnosticArgument>>
pub fn id(&self) -> i32
pub fn custom_kind(&self) -> Option<Rc<dyn Any>>
pub fn set_custom_kind(&self, id: Option<Rc<dyn Any>>)
Sourcepub fn format_with_message(&self, message: &str, id: Option<i32>) -> String
pub fn format_with_message(&self, message: &str, id: Option<i32>) -> String
Formats the diagnostic by overriding the message text.
Sourcepub fn format_with_message_and_base_path(
&self,
message: &str,
id: Option<i32>,
base_path: Option<&str>,
) -> String
pub fn format_with_message_and_base_path( &self, message: &str, id: Option<i32>, base_path: Option<&str>, ) -> String
Formats the diagnostic by overriding the message text and providing a base Whack package’s path (to relativize the source path).
Sourcepub fn format_english(&self) -> String
pub fn format_english(&self) -> String
Formats the diagnostic in English.
Sourcepub fn format_english_with_base_path(&self, base_path: &str) -> String
pub fn format_english_with_base_path(&self, base_path: &str) -> String
Formats the diagnostic in English.
pub fn format_message_english(&self) -> String
pub fn format_message(&self, messages: &HashMap<i32, String>) -> String
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Ord for Diagnostic
impl Ord for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§impl PartialOrd for Diagnostic
impl PartialOrd for Diagnostic
impl Eq for Diagnostic
Auto Trait Implementations§
impl !Freeze for Diagnostic
impl !RefUnwindSafe for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl Unpin for Diagnostic
impl !UnwindSafe for Diagnostic
Blanket Implementations§
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.