Comments (2)
@brokenthorn I agree. I think it makes it much clearer as to what's going on, however it's more idiomatic again to implement TryFrom<&str>
for Selector
. The From
(and implied Into
) traits are meant for conversions that won't fail. Using their Try*
equivalents returns a Result
which makes more sense. By implementing TryFrom
we get TryInto
for free also.
Note, that it would be awesome to do something even more generic like this: impl<'i, T: Deref<Target = str>> TryFrom<&'i T> for Selector
so that we get deref coercion automatically but at the moment that will cause a conflict with the blanket implementation in core
(see rust-lang/rust#50133 (comment)).
from scraper.
Isn't it more idiomatic Rust to implement Into<Selector>
for str and/or String, instead of adding an extra function try_select
, in #30 ?
from scraper.
Related Issues (20)
- Make element traversal more convenient HOT 2
- [Feature Request] Find by Text HOT 1
- Dom Nodes closes prematurely on recursion HOT 4
- How to select contains and start with? HOT 1
- any way to scrape in a stream? HOT 2
- Support for `:has()` selector HOT 8
- Implement Send for ElementRef HOT 16
- Convert <br> to '\n' in `text`? HOT 1
- future created by async block is not `Send` HOT 2
- Upgrade ahash HOT 1
- Html and its children do not impl Send HOT 5
- Scraper logs 1gb HOT 4
- Select::parse fails due to borrow the css query HOT 26
- select() doesn't work on current ElementRef HOT 2
- The problem of creating a structure with the Select field HOT 7
- Get text of element without children HOT 8
- Future is no longer Send HOT 5
- Should ego-tree be reexported by this crate? HOT 1
- Selector for nodes
- More explicit description to Element type and some doc complement HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scraper.