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

Add SavedAsPointer and it's mutable part as trait #456

Closed
wants to merge 1 commit into from

Conversation

kloenk
Copy link
Member

@kloenk kloenk commented Jul 23, 2021

This will be used for NetDevice and NlAttr wrappers in #439

SavedAsPointer is a trait for types which are saving a direct pointer
from the C side as a rust Wrapper.

Signed-off-by: Finn Behrens <me@kloenk.de>
@kloenk kloenk requested a review from wedsonaf July 23, 2021 12:42
@kloenk kloenk added the • lib Related to the `rust/` library. label Jul 23, 2021
@@ -247,3 +247,52 @@ impl<T: FnOnce()> Drop for ScopeGuard<T> {
}
}
}

/// Trait for wrappers which are holding a direct pointer that they are getting from a C side function.
pub trait SavedAsPointer {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why you can't use PointerWrapper? We should unify all these pointer wrappers.

Copy link
Member Author

Choose a reason for hiding this comment

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

My Understanding of PointerWrapper is that it is designed for rust types which can be given to a C interface. The trait I am implementing is designed to hold a pointer which got allocated via a C api.

Copy link
Member Author

Choose a reason for hiding this comment

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

@wedsonaf is my understanding of PointerWrapper correct? if not, should I withdraw this pr?

@kloenk
Copy link
Member Author

kloenk commented Nov 25, 2021

This is similar to #557 but that does not implement the get_internal functions. closing it, as it got stall

@kloenk kloenk closed this Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
• lib Related to the `rust/` library.
Development

Successfully merging this pull request may close these issues.

None yet

2 participants