Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign crate to use inherent impls over traits #35

Merged
merged 1 commit into from
May 18, 2019

Conversation

ebkalderon
Copy link
Owner

Added

  • Add HasPrevious trait to recursively determine version compatibility at compile-time.

Changed

  • Redesign API as inherent struct implementations with Deref and DerefMut for handling backwards compatibility.
  • Rename Version to VersionCode, ApiVersion trait to Version.
  • Use a single Entry type, since the aliases point to the same struct.
  • Move CaptureOptions, InputButton, OverlayBits to settings.rs.
  • Move DeviceHandle and WindowHandle to handles.rs.

Removed

  • Remove the prelude module.
  • Remove the api module.
  • Remove RenderDocV### trait boilerplate code from renderdoc-derive.

This should improve the user experience for this crate by eliminating the obnoxious trait-heavy abstraction and relying on inherent implementations instead. The code is kept maintainable by using Deref and DerefMut to overlay semver-compatible API versions together, and with the HasPrevious trait to determine what methods may be called for which version entirely at compile-time.

@ebkalderon ebkalderon self-assigned this May 18, 2019
* Redesign API as inherent struct implementations with `Deref` and
  `DerefMut` for handling backwards compatibility

* Rename `Version` to `VersionCode`, `ApiVersion` trait to `Version`

* Use a single `Entry` type, since the aliases point to the same struct

* Add `HasPrevious` trait to recursively determine version compatibility
  at compile-time

* Remove the `prelude` module

* Remove the `api` module

* Move `CaptureOptions`, `InputButton`, `OverlayBits` to `settings.rs`

* Move `DeviceHandle` and `WindowHandle` to `handles.rs`

* Remove `RenderDocV###` trait boilerplate code from `renderdoc-derive`
@ebkalderon ebkalderon force-pushed the feature/eliminate-api-traits branch from a0c21f9 to bf17956 Compare May 18, 2019 20:40
@ebkalderon ebkalderon merged commit d0d4ddf into master May 18, 2019
@ebkalderon ebkalderon deleted the feature/eliminate-api-traits branch May 18, 2019 20:43
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