diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-31 15:00:52 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2016-12-31 23:24:19 +0100 |
commit | 858ee1f1ecf6e65f4b8c7f16a5b881e1ff306963 (patch) | |
tree | 542d7c4735996c62042df7bdfeef8a9006b90bf9 /components/style/error_reporting.rs | |
parent | 4108ff838387f87333730d30907fd4e279d96fc7 (diff) | |
download | servo-858ee1f1ecf6e65f4b8c7f16a5b881e1ff306963.tar.gz servo-858ee1f1ecf6e65f4b8c7f16a5b881e1ff306963.zip |
style: Document the error_reporting module.
Diffstat (limited to 'components/style/error_reporting.rs')
-rw-r--r-- | components/style/error_reporting.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/components/style/error_reporting.rs b/components/style/error_reporting.rs index 17d4ce7bb00..3a802bdd6c6 100644 --- a/components/style/error_reporting.rs +++ b/components/style/error_reporting.rs @@ -4,14 +4,27 @@ //! Types used to report parsing errors. +#![deny(missing_docs)] + use cssparser::{Parser, SourcePosition}; use log; +/// A generic trait for an error reporter. pub trait ParseErrorReporter { + /// Called the style engine detects an error. + /// + /// Returns the current input being parsed, the source position it was + /// reported from, and a message. fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str); + /// Clone this error reporter. + /// + /// TODO(emilio): I'm pretty sure all the box shenanigans can go away. fn clone(&self) -> Box<ParseErrorReporter + Send + Sync>; } +/// An error reporter that reports the errors to the `info` log channel. +/// +/// TODO(emilio): The name of this reporter is a lie, and should be renamed! pub struct StdoutErrorReporter; impl ParseErrorReporter for StdoutErrorReporter { fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str) { |