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 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//! # /*
You can’t perform that action at this time.
0 commit comments