utkarshkukreti / select.rs

A Rust library to extract useful data from HTML documents, suitable for web scraping.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node methods could probably return &'a references

habnabit opened this issue · comments

commented

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.