File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 196
196
//! }
197
197
//! ```
198
198
//!
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.
200
202
//!
201
203
//! ```
202
204
//! # 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.
204
206
//! #[derive(Error, Debug)]
205
207
//! #[error(transparent)]
206
- //! pub struct LibError (#[from] ErrorRepr);
208
+ //! pub struct PublicError (#[from] ErrorRepr);
207
209
//!
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.
209
215
//! #[derive(Error, Debug)]
210
216
//! enum ErrorRepr {
211
217
//! # /*
You can’t perform that action at this time.
0 commit comments