Comments (6)
I don’t think it makes sense to consider an URL intrinsically "greater" or "lesser" than another. But what’s the use case?
from rust-url.
The need for this is derived from Cargo, which primarily uses it for deterministic output in a few locations. There are spots where we sort an array of PackageId
(which transitively contains a Url at some point) to ensure that the output is consistent among stages. Put another way, the order itself isn't super important so long as it's consistent.
I personally view core traits like this as being useful to define on core types like Url
, even when they don't always make 100% sense (e.g. PartialEq
for RefCell
)
from rust-url.
Ok, that sounds like a real use case and I don’t have better way to solve it. I still don’t think any ordering is meaningful for URLs, but adding a few #[derive(PartialOrd)]
is not harmful either.
I don’t get your second point, though. What qualifies as a core trait? Should Url
implement Add
, for example? What qualifies as a core type? What makes Url
more "core" than, say, cssparser::RGBA
? As to RefCell
, since it’s a container it doesn’t need to have a meaningful equality by itself, it just defers to its contents.
from rust-url.
Ah I just mean "core" in the sense that it's often a building block for many other types. For example there are probably going to be a lot of structs which store a Url
, some of which may want to have some sort of ordering eventually.
from rust-url.
As for whether Ordering makes sense for Url: it seems natural that it would
be the same as Ord for strings: likely alphabetically.
On Mon, Jun 1, 2015, 11:08 AM Alex Crichton [email protected]
wrote:
Ah I just mean "core" in the sense that it's often a building block for
many other types. For example there are probably going to be a lot of
structs which store a Url, some of which may want to have some sort of
ordering eventually.—
Reply to this email directly or view it on GitHub
#114 (comment).
from rust-url.
Ordering URLs by the string ordering of their serialization seems reasonable, but it’s not the same ordering as what #[derive(PartialOrd)]
would get us with the current internal representation. Still, we should probably stick with derive
, to avoid performance issues like #113.
from rust-url.
Related Issues (20)
- Add parameter spaceAsPlus to ByteSerialize
- Incorrect parsing of Windows drive letter quirk
- Invalid IPv4 but parsing success HOT 1
- URL http:www.google.com is passed as validated HOT 1
- Host should implement deserialize to parse strings
- JOIN functionality not working HOT 4
- URL validity change between 2.2 and 2.3. HOT 2
- Documentation for IDNA configuration options should explain use cases
- Feature request: add parser boolean option to leave relative paths in the URL.
- Neither punycode::encode_str nor Config::...::to_ascii return expected results for single Unicode char and "EXAMPLE" HOT 3
- `Url::from_file_path()` incorrect handling of backslash on linux
- `=` is not being escaped as query value HOT 2
- [DataUrl] Unable to parse application/json;utf8 containing # HOT 1
- Feature request: provide separate struct for URL which is can-be-base
- Error: 🚫 Building project failed: error[E0583]: file not found for module `origin`serde, interproc... HOT 2
- Poping a path segment removes slash separator HOT 2
- No hostname format validation in URL HOT 5
- The input urls generated by the fuzzer can be problematic as it causes very long parse times
- Incorrect error when url contains number sign HOT 1
- URI and IRI support? HOT 1
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 rust-url.