Node methods could probably return &'a references
habnabit opened this issue · comments
If Node::attr
etc. returned Option<&'a str>
instead of Option<&str>
the return values could be used without keeping a Node
alive. I think all of these methods that return a &T
right now could return &'a T
, like Node::raw
returning &'a Raw
.
Thank you @habnabit! I didn't know much about lifetime elision when I wrote this code and I never ran into a situation where I wanted to keep any of these values alive longer than the Node. I've pushed a fix just now.