Skip to content

Commit 5271eb3

Browse files
committed
Touch up PR 195
1 parent 8e8e41d commit 5271eb3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/lib.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,22 @@
196196
//! }
197197
//! ```
198198
//!
199-
//! Another use-case is making semver-resilient opaque error types:
199+
//! Another use case is hiding implementation details of an error
200+
//! representation behind an opaque error type, so that the representation is
201+
//! able to evolve without breaking the crate's public API.
200202
//!
201203
//! ```
202204
//! # use thiserror::Error;
203-
//! /// `LibError` is public, but opaque and easy to keep compatible.
205+
//! // PublicError is public, but opaque and easy to keep compatible.
204206
//! #[derive(Error, Debug)]
205207
//! #[error(transparent)]
206-
//! pub struct LibError(#[from] ErrorRepr);
208+
//! pub struct PublicError(#[from] ErrorRepr);
207209
//!
208-
//! /// `ErrorRepr` is private and easy to change.
210+
//! impl PublicError {
211+
//! // Accessors for anything we do want to expose publicly.
212+
//! }
213+
//!
214+
//! // Private and free to change across minor version of the crate.
209215
//! #[derive(Error, Debug)]
210216
//! enum ErrorRepr {
211217
//! # /*

0 commit comments

Comments
 (0)