Commit Graph

34 Commits

Author SHA1 Message Date
Raphael Nestler 0a8dd9a961 Simplify example usage of Magnet struct 2021-05-31 15:31:49 +02:00
William Batista 4e26974f59
Added syntax highlighting 2021-05-20 18:31:25 -04:00
William Batista c90c3d0bd5
v1.2.2 2021-05-20 12:52:27 -04:00
William Batista 04cb175b8a
Removed custom to_string implementation with fmt::Display
Just for kicks I ran clippy through the program, and just changed it so that fmt::Display was implemented.
2021-05-20 12:51:06 -04:00
William Batista efd10aa82b
v1.2.1
I forgot to change the patch version number...
2021-02-18 13:11:33 -05:00
William Batista fe09f6f6fa
v1.2.1
I forgot to add the new documentation to the README
2021-02-18 12:58:05 -05:00
William Batista dbffe62a40
v1.2.0 2021-02-18 12:50:05 -05:00
William Batista 0d5eeff1fc
Added to_string(), new_no_validation and some Traits
to_string is a basic function that tries to generate a minimal magnet_url from a Magnet struct.

The new function was turned into a wrapper of no_new_validation, with the difference being that new makes sure that the magnet str given is a valid magnet url. This should theoretically increase speeds for those who use new_no_validation.

I also added Debug, Clone, Hash, and PartialEq traits to the struct, meaning that the struct is now a little bit more useful in general.

Of course I also added some tests of to_string and the new Traits
2021-02-18 12:49:06 -05:00
William Batista 79b360792b
Bug fix with verification of magnet url's
When I changed it to just check a str slice against a str, it would never panic since I put in the str wrong, AND I made it so it had t be equal to said str to panic, not the other way around. Yikes.
2021-02-18 10:06:35 -05:00
William Batista 648478bd50
Fixed some typos
Just for a specific reddit user jaja. Also did some minor changes with how the string parsing is done.
2021-02-17 18:18:36 -05:00
William Batista 69ef3cd675
v1.1.1 2021-02-17 16:47:48 -05:00
William Batista 0bef3c6e40
Added benchmarks + optimizations
As one redditor stated, I'm claiming that my program is fast without benchmarks. Here's said benchmark ;). The benchmarks use Criterion and just see how many magnet url's it can make per second. On the sluggish laptop I'm using at the moment, I get around 50K/s.

Removed redundant if statement in lib.rs for the tr field, increasing performance by 40%.

Made it so that the xl field uses a customized match statement for its output, basically making it so it converts from a str to an int, further increasing performance by 11%.
2021-02-17 16:44:36 -05:00
William Batista f2ae4d9be2
v1.1.0 2021-02-17 10:20:32 -05:00
William Batista d83f888da7
Library now panics! on invalid magnet url
Another helpful redditor warned me about the dangers of not validating
that the URL given is a magnet url. Unfortuanetly, I can't just change
everything to use Options and Errors, so I'm making the fix of having
the library just panic instead, since that would make it still
backwards compatible. This will be changed in version 2.0.0
2021-02-17 10:15:02 -05:00
William Batista f3bf0aeff2
v1.0.5 2021-02-17 08:37:17 -05:00
William Batista e452658bc8
Minor documentation improvements
I got some feedback from Redditors, and addd some information as to what
a magnet url is, and why a magnet-url parser is useful
2021-02-17 08:35:23 -05:00
William Batista 95f912f950
v1.0.4 2021-02-16 20:46:48 -05:00
William Batista b5c8b4b37a
Changed license-file to license in Cargo.toml
This is so that crates.io doesn't think that my license is non-standard
2021-02-16 20:12:29 -05:00
William Batista 028700b588
v1.0.3 2021-02-16 16:08:44 -05:00
William Batista fcb75352c1
Added tests, Regex bug fix
I added some tests so that I can actually make sure everything works in
the parser. Also made a quick bug fix in any regex that looks for http
links, since they're very likely to be URL encoded.
2021-02-16 16:06:11 -05:00
William Batista 4fe6e9b828
Incrementing minor version by 1 2021-02-16 15:26:25 -05:00
William Batista 67767230ab
Even more documentation bug fixes
Okay. Now everything should work. I realized that cargo doc doesn't test
that documentation code works, but that cargo test does.
2021-02-16 15:23:32 -05:00
William Batista d08713b412
More documentation bug fixes
You can't use dashes in variable names(?)
2021-02-16 15:18:56 -05:00
William Batista 03f4cf1741
Fixed documentation examples
I put one colon instead of two
2021-02-16 15:13:13 -05:00
William Batista 134fcc5b50
Added build status from Travis CI
There's been a lot of commits because of the mistakes I've made on this
repo. This should be the last one.
2021-02-16 15:10:06 -05:00
William Batista 10f4f5d002
Added Travis CI
Now I can actually make sure builds will compile before pushing them
jaja
2021-02-16 15:08:09 -05:00
William Batista 1a54eedf24
Bug fix in Regex
Removed an unnecessary backwards parantheses, renamed project again
2021-02-16 14:55:27 -05:00
William Batista 41164ac5ba
Renamed crate to magnet_url
I didn't realize you can't import crates with a dash in their name :(
2021-02-16 14:37:31 -05:00
William Batista e4e1d3283f
Renamed crate in documentation
I'm an idiot and forgot to rename the library in the documentation
2021-02-16 14:07:38 -05:00
William Batista f1cc2a5ca8
Slightly changed name of Cargo project
Just removed the -rs part, in order to fit the Rust naming standards
better
2021-02-16 13:57:19 -05:00
William Batista 38082c9cce
Minor bug fix
I removed the MAGNET_RE stuff, since it isn't used in the program.
2021-02-16 13:55:52 -05:00
William Batista bb72101215
Added LICENSE.md
Forgot to add it in the initial commit, whoops.
2021-02-16 13:46:25 -05:00
William Batista 0b632edb9a
Added Magnet Parsing Code
The ode basically uses a ton of regex checks to find specific parts of the magnet url, and then chops it up into the Magnet struct.
2021-02-16 13:45:20 -05:00
William Batista ab009683c2
Initial commit 2021-02-15 18:22:02 -05:00