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

Dereference optional object type #16

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

arg0d
Copy link
Collaborator

@arg0d arg0d commented Jan 19, 2024

optional<shared_ptr<T>> does not make sense for C++, since shared_ptr<T> can represent empty state by itself.

The transformation is implemented in couple of steps:

  1. Remove optional<> for type labels to make optional<shared_ptr<T>> appear as shared_ptr<T> where the optional type is referenced

  2. To maintain RustBuffer ABI compatibility, optional converter converts from optional<shared_ptr<T>> to shared_ptr<T> while keeping the read/write logic for optional byte.

`optional<shared_ptr<T>>` does not make sense for C++, since
`shared_ptr<T>` can represent empty state by itself.

The transformation is implemented in couple of steps:
1. Remove `optional<>` for type labels to make `optional<shared_ptr<T>>`
appear as `shared_ptr<T>` where the optional type is referenced

2. To maintain RustBuffer ABI compatibility, optional converter converts
from `optional<shared_ptr<T>>` to `shared_ptr<T>` while keeping the
read/write logic for optional byte.

Signed-off-by: Kristupas Antanavičius <[email protected]>
@arg0d arg0d force-pushed the kristupas/dereference-optional-object branch from b2418b8 to 4355462 Compare January 19, 2024 16:08
Copy link
Member

@Lipt0nas Lipt0nas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice, that neatly cleans up the user-facing API

@Lipt0nas Lipt0nas merged commit b6cda19 into main Jan 23, 2024
3 checks passed
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.

2 participants