Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Commit c81a5bb

Browse files
committed
Improve doc.
1 parent dd4551d commit c81a5bb

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/error_chain.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,16 @@ macro_rules! error_chain_processed {
5050
}
5151

5252
) => {
53-
/// The Error type
53+
/// The Error type.
5454
///
55-
/// This has a simple structure to support pattern matching
56-
/// during error handling. The second field is internal state
57-
/// that is mostly irrelevant for error handling purposes.
55+
/// This struct is made of three things:
56+
///
57+
/// - an `ErrorKind` which is used to determine the type of the error.
58+
/// - a backtrace, generated when the error is created.
59+
/// - an error chain, used for the implementation of `Error::cause()`.
5860
#[derive(Debug)]
5961
pub struct $error_name {
62+
// The members must be `pub` for `links`.
6063
/// The kind of the error.
6164
#[doc(hidden)]
6265
pub kind: $error_kind_name,
@@ -82,7 +85,7 @@ macro_rules! error_chain_processed {
8285

8386
#[allow(dead_code)]
8487
impl $error_name {
85-
/// Constructs an error from a kind.
88+
/// Constructs an error from a kind, and generates a backtrace.
8689
pub fn from_kind(kind: $error_kind_name) -> $error_name {
8790
$error_name {
8891
kind: kind,
@@ -189,7 +192,7 @@ macro_rules! error_chain_processed {
189192
// --------------
190193

191194
quick_error! {
192-
/// The kind of an error
195+
/// The kind of an error.
193196
#[derive(Debug)]
194197
pub enum $error_kind_name {
195198

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ mod error_chain;
272272
#[cfg(feature = "example_generated")]
273273
pub mod example_generated;
274274

275-
/// Iterator over the error chain.
275+
/// Iterator over the error chain using the `Error::cause()` method.
276276
pub struct ErrorChainIter<'a>(pub Option<&'a error::Error>);
277277

278278
impl<'a> Iterator for ErrorChainIter<'a> {

0 commit comments

Comments
 (0)