241b1dcdf8
netsize: Hash implementation to match PartialEq ( #186 )
...
* netsize: hash implementation to match PartialEq
* netsize: Prefer `From` over `Into`, add documentation, and add Hash and PartialEq tests
2024-04-29 22:23:28 -05:00
a1966d4089
Add const unsafe new_unchecked
to Ipv4Network
& Ipv6Network
( #185 )
...
* Add const unsafe `new_unchecked` to `Ipv4Network` & `Ipv6Network`
* New tests added for `new_unchecked` functions
2023-12-21 09:03:04 -06:00
1bd937e90c
Add Ipv6Network::nth
to get the nth address (take two) ( #176 )
...
* Add `Ipv6Network::nth` to get the nth address
Works the same as `Ipv4Network::nth`, but using a `u128` index instead
of `u32`.
* add IpNetwork v6 nth test
---------
Co-authored-by: Josh Triplett <josh@joshtriplett.org >
2023-06-13 21:17:39 -05:00
d19ac33071
Added needed traits to NetworkSize
( #175 )
...
* Add conversion and better equality traits to NetworkSize
* Add tests for NetworkSize conversion/equality
* impl Display for NetworkSize
2023-06-13 21:14:02 -05:00
0bb1ea8fd4
Replace assert_eq with assert for bool comparison
2023-04-07 14:36:02 -05:00
b624487f72
Use cargo clippy --fix to autofix code
2023-04-07 14:36:02 -05:00
dff59ea0a5
Add a reference where missing
2023-04-07 12:00:03 -05:00
432f7342e3
Cleanup mask for Ipv4Addr
2023-04-07 12:00:03 -05:00
b15eb54695
Shrink the enumerate call on mask
2023-04-07 12:00:03 -05:00
ec79428c75
Cleanup both size functions
2023-04-07 12:00:03 -05:00
a96f30d64e
Simplify FromStr for Ipv6Network
2023-04-07 12:00:03 -05:00
ef3f536d48
Make parse_prefix more idiomatic
2023-04-07 12:00:03 -05:00
ab6f1012b3
Correct and validate JsonSchema for Ipv4Network, Ipv6Network, and IpNetwork ( #157 )
...
* show failed test cases
* add proper JSON schema
2022-06-28 21:27:13 -05:00
86dbbd997a
[ #153 ] Add optional JSONSchema implementation for IpNetwork
...
Problem: No instance of `JSONSchema` is implemented for
`IpNetwork`.
Solution: Derive implementation via `schemars`. Add corresponding
feature to the crate.
2022-05-31 23:37:44 +03:00
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