Skip to content

refactor!: replace Deref with accessor methods on ServiceFailure and RemoteError - #11

Merged
ae2rs merged 1 commit into
mainfrom
refactor/replace-deref-with-accessors
May 26, 2026
Merged

refactor!: replace Deref with accessor methods on ServiceFailure and RemoteError#11
ae2rs merged 1 commit into
mainfrom
refactor/replace-deref-with-accessors

Conversation

@ae2rs

@ae2rs ae2rs commented May 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Remove Deref/DerefMut impls from ServiceFailure<E> and RemoteError, replacing implicit field access with explicit accessor methods
  • Remove RemoteErrorPartsRemoteError::from_parts() now accepts RemoteErrorInner directly (the two structs were identical)
  • Restrict visibilityServiceFailureInner is now pub(crate), RemoteErrorInner fields are now pub(crate)
  • Bump to 0.7.0 — this is a breaking API change

New accessor methods

ServiceFailure<E>: inner(), inner_mut(), frames(), frames_mut(), trace(), trace_mut()

RemoteError: category(), type_id(), frames(), trace(), outer_code(), outer_message()

Migration guide

- sf.inner
+ sf.inner()
- sf.frames.push(f)
+ sf.frames_mut().push(f)
- sf.trace.trace_id
+ sf.trace().trace_id
- r.type_id
+ r.type_id()
- r.category
+ r.category()
- RemoteErrorParts { ... }
+ RemoteErrorInner { ... }

Test plan

  • All 50 workspace tests pass (unit, integration, UI, doctests)
  • Examples (trace_chain, basic) compile and updated
  • cargo fmt --all clean
  • No compiler warnings

🤖 Generated with Claude Code

…ceFailure and RemoteError

BREAKING CHANGE: ServiceFailure and RemoteError no longer implement
Deref/DerefMut to their inner state structs. Field access like
`sf.inner`, `sf.frames`, `sf.trace` must be replaced with accessor
methods: `sf.inner()`, `sf.frames()`, `sf.trace()`. Mutable access
uses `sf.inner_mut()`, `sf.frames_mut()`, `sf.trace_mut()`.

RemoteErrorParts has been removed; RemoteError::from_parts() now
accepts RemoteErrorInner directly. RemoteError fields are accessed
via methods: `r.category()`, `r.type_id()`, `r.frames()`,
`r.trace()`, `r.outer_code()`, `r.outer_message()`.

ServiceFailureInner visibility is now pub(crate).
RemoteErrorInner fields are now pub(crate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ae2rs
ae2rs merged commit 4766756 into main May 26, 2026
4 checks passed
@ae2rs
ae2rs deleted the refactor/replace-deref-with-accessors branch May 26, 2026 09:16
ae2rs added a commit that referenced this pull request May 26, 2026
…RemoteError (#11)

refactor!: replace Deref<Target=Inner> with accessor methods on ServiceFailure and RemoteError

BREAKING CHANGE: ServiceFailure and RemoteError no longer implement
Deref/DerefMut to their inner state structs. Field access like
`sf.inner`, `sf.frames`, `sf.trace` must be replaced with accessor
methods: `sf.inner()`, `sf.frames()`, `sf.trace()`. Mutable access
uses `sf.inner_mut()`, `sf.frames_mut()`, `sf.trace_mut()`.

RemoteErrorParts has been removed; RemoteError::from_parts() now
accepts RemoteErrorInner directly. RemoteError fields are accessed
via methods: `r.category()`, `r.type_id()`, `r.frames()`,
`r.trace()`, `r.outer_code()`, `r.outer_message()`.

ServiceFailureInner visibility is now pub(crate).
RemoteErrorInner fields are now pub(crate).

Co-authored-by: ae2rs <ae2rs@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant