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

Draft: subclass: Add missing BuildableImpl vfuncs #900

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bilelmoussaoui
Copy link
Member

No description provided.

@bilelmoussaoui
Copy link
Member Author

I haven't got the time to clean things up, will get back to it pretty soon i hope

);
fn custom_tag_end(
tag_name: &str,
parser_data: *mut *mut libc::c_void,
Copy link
Member

Choose a reason for hiding this comment

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

How is this pointer used exactly?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is used to pass the state to the BuildableParser, my idea was to create a struct that implements a certain trait and move the struct around instead of passing a random ptr around

Copy link
Member

Choose a reason for hiding this comment

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

Sounds like a good plan :) Where would the struct be freed, is the finish() function guaranteed to be called exactly once with the same parser data, for example?

}
}

pub unsafe trait BuildableParserImpl: Sized {
Copy link
Member

Choose a reason for hiding this comment

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

Why does it have to be unsafe?

Copy link
Member Author

Choose a reason for hiding this comment

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

It shouldn't, I made it unsafe at first before figuring out what the user_data pointers are used for. Ideally once this PR is ready, we shouldn't need that

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