-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor Binding and Prefix to use Rc for pointers #57
base: master
Are you sure you want to change the base?
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just have a few thoughts
use std::rc::{Rc, Weak}; | ||
use std::slice; | ||
|
||
type Ptr<T> = Option<Rc<T>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
No description provided.