This repository was archived by the owner on Feb 10, 2026. It is now read-only.
Refactor Binding and Prefix to use Rc for pointers#57
Open
Refactor Binding and Prefix to use Rc for pointers#57
Conversation
… instead of a raw pointer, and give it the same lifetime as the DTD and scaffold
…in XML_ParserStruct and get rid of the 'parser lifetime
Simplify Rc<T> by using the standard implementation for most operations, and just implementing Rc::try_new
…reate_parser test pass
…t_nsalloc_realloc_long_ge_name
…hods take an immutable reference
TheDan64
reviewed
May 11, 2020
Contributor
TheDan64
left a comment
There was a problem hiding this comment.
Looks good overall, just have a few thoughts
| use std::rc::{Rc, Weak}; | ||
| use std::slice; | ||
|
|
||
| type Ptr<T> = Option<Rc<T>>; |
Contributor
There was a problem hiding this comment.
If I hadn't seen this alias, it wouldn't have been obvious what Ptr<T> is. OptRc<T> would be more obvious, but at that point it's not far off from Option<Rc<T>>. Is the full type that verbose that it warrants an alias?
| pub notation: Cell<*const XML_Char>, | ||
| pub open: Cell<XML_Bool>, | ||
| pub is_param: Cell<XML_Bool>, | ||
| pub is_internal: Cell<XML_Bool>, |
Contributor
There was a problem hiding this comment.
I know that this simplifies a lot, but I keep wondering if it's becoming an anti-pattern if we have to use it absolutely everywhere
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.