Commit Graph

156 Commits

Author SHA1 Message Date
501e5533d7 Remove the redundant html_root_url attribute 2022-04-12 22:35:37 -05:00
a57afd9e1a Remove useless allocation when serializing 2021-12-29 16:07:07 +01:00
c9b2bc5519 Cut a new release for v0.18.0 2021-04-13 18:29:34 -05:00
9921661ebe Always inline the contains function
This function is commonly called in a loop (or iterator). Inlining it
makes it run faster, which is beneficial in this case.
2021-04-04 23:15:58 -05:00
1f3e10f73d Reexport underlying iterators and do not implement Copy
Closes #138
2021-02-15 11:12:15 -06:00
8fcff82c7b Convert Ipv{4,6}Network::new to const functions
IpNetwork::new cannot be const since it is not supported with the ?
operator

Closes #111
2020-08-27 18:01:07 +01:00
e15e8cb812 Implement TryFrom<&str> for all basic types
Also improve some docs and FromStr type signature
Closes #135
2020-08-09 22:27:49 +01:00
6c6bdb333d Cut a new release 2020-07-13 11:45:28 +01:00
45fbf458b3 Address all changes clippy pointed out 2020-01-18 17:53:15 +00:00
65bd6724c2 Remove the clippy plugin
And update instructions to run clippy from cargo
2020-01-18 17:39:07 +00:00
f23ea4d7d6 Add a few deny lints
And conform to the new ones
2020-01-18 11:03:37 +00:00
ca2da8ae30 Uprev for a new release 2020-01-08 10:37:12 +00:00
4dfdf142d0 Cleanup comment on IPv6 implementation 2020-01-08 10:29:58 +00:00
18677e3b69 Run cargo fmt 2020-01-05 11:38:28 +00:00
986ee0ba1c Check against specific errors in parsing test 2020-01-05 11:36:49 +00:00
87ea7b24fa Be able to parse the netmask format
Allow accepting the netmask format, eg 192.168.1.0/255.255.255.0, in
addition to the more modern /24 prefix version.

Adding support for IPv4 only, as IPv6 never actually used that format in
practice.

Closes #107.
2019-12-21 16:19:20 +01:00
08126f5103 Merge pull request #109 from mullvad/optional-serde
Make the serde dependency optional
2019-12-13 16:23:08 +00:00
fa5deed40b Make the serde dependency optional 2019-12-11 12:51:39 +01:00
5b09d82d43 Fix bug with overflow in iterator 2019-12-11 09:40:55 +01:00
dbf366cfdf Iterators: reproducer for overflow on high end of iteration 2019-12-11 09:40:55 +01:00
6cbb011597 Iterators for the IpNetwork
Version-agnostic iterator in addition to the version specific ones.
2019-12-11 09:40:55 +01:00
f7d9524f70 Make the iterators slightly better
* Implement some useful traits on them.
* Make reference an into-iterator.
2019-12-11 09:40:55 +01:00
152f1a8393 ipnetwork: add netmask constructors
This adds constructors to build all network types from a network
address and network mask pair.
2019-11-27 17:20:59 +00:00
31fc25f9ce cargo: rustfmt whole project 2019-11-27 15:50:47 +00:00
d54f463f86 Uprev for a new release 2019-11-23 13:48:22 +00:00
26706b3790 Use slice::iter instead of into_iter to avoid future breakage
`an_array.into_iter()` currently just works because of the autoref
feature, which then calls `<[T] as IntoIterator>::into_iter`. But
in the future, arrays will implement `IntoIterator`, too. In order
to avoid problems in the future, the call is replaced by `iter()`
which is shorter and more explicit.
2019-10-30 15:32:11 +01:00
9e42aaeb3e Uprev for a new release 2019-09-12 20:25:48 +01:00
a6dfadc21d Manual import cleanup 2019-03-25 15:24:17 +01:00
61eeb5843f Run cargo fix --edition-idioms 2019-03-25 15:15:41 +01:00
c2d4b9aeae Run cargo fix --edition 2019-03-25 15:13:50 +01:00
10d12cd945 Deserialize from String rather &str for ipnetwork:Ipv{4,6}Network 2019-02-20 11:07:29 +00:00
e7c85b5b81 Implement overlaps for both types 2019-02-06 23:29:46 +00:00
439a0deeb7 Implement is_subnet_of and is_supernet_of 2019-02-06 23:14:07 +00:00
1b06452e88 Optimise contains for IPv4 2019-02-02 23:57:25 +00:00
a19f24a9c6 Add a benchmark for CIDR parsing
Also optimise the cidr_parts implementation
2019-02-02 21:54:16 +00:00
1f96439a87 Prepare new release 2019-02-01 22:16:38 +00:00
d8ce2e4dbc Added custom deserialization and serialization for ipnetwork::IpNetwork 2019-02-01 12:01:33 +00:00
1d57287c77 Use from casts in some more places 2018-11-26 16:50:33 +05:30
2b21f38171 Change return type of Ipv4Network::size to u32
Also, generalize size over IpvNetwork
NOTE: this is a breaking change
2018-11-21 15:48:29 +00:00
a8edccafa1 Export network and broadcast for IpNetwork
Adopted from https://github.com/achanda/ipnetwork/pull/78
2018-11-10 21:04:41 +00:00
1f3d42d89f Release 0.13.1 2018-08-31 23:27:53 +01:00
5e7eb0bd1b Parse IpAddr using Ipv4Addr::from_str 2018-05-27 19:26:11 -05:00
9ac9df11e2 Uprev for release 2018-05-12 14:04:16 +01:00
bbcc53cd94 Remove the feature flag for 128 bit integers
Since it is stable now
2018-05-12 13:53:59 +01:00
2286d58728 cargo fmt and clippy 2018-04-17 19:28:45 -05:00
c6ead9d654 remove serde feature flag 2018-04-17 19:28:38 -05:00
de707e35ae Remove with-serde in favor of just 'serde'
https://rust-lang-nursery.github.io/api-guidelines/naming.html#feature-names-are-free-of-placeholder-words-c-feature
2018-04-17 17:03:42 -05:00
4e97146605 No need to implement serialize/deserialize for enum, use serde(untagged) 2018-04-17 06:30:44 -05:00
4414ae4f0f direct serialize/deserialize from string/to string 2018-04-16 19:25:22 -05:00
15fa093618 cargo fmt 2018-04-15 21:15:36 -05:00