Skip to content

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

Closed
kloenk wants to merge 1 commit into
Rust-for-Linux:rustfrom
kloenk:savedaspointer
Closed

Add SavedAsPointer and it's mutable part as trait#456
kloenk wants to merge 1 commit into
Rust-for-Linux:rustfrom
kloenk:savedaspointer

Conversation

@kloenk

Copy link
Copy Markdown
Member

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 wedsonafJuly 23, 2021 12:42
@kloenkkloenk added the • lib Related to the `rust/` library. label Jul 23, 2021
Comment threadrust/kernel/types.rs
}

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

Copy link
Copy Markdown

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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

@kloenkkloenk closed this Nov 25, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

• libRelated to the `rust/` library.

Development

Successfully merging this pull request may close these issues.

2 participants

@kloenk@wedsonaf