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
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
a57afd9e1a
Remove useless allocation when serializing
2021-12-29 16:07:07 +01: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
45fbf458b3
Address all changes clippy pointed out
2020-01-18 17:53:15 +00:00
f23ea4d7d6
Add a few deny lints
...
And conform to the new ones
2020-01-18 11:03:37 +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
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
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
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
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
1d57287c77
Use from casts in some more places
2018-11-26 16:50:33 +05:30
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
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
72326bd96f
use an option
2018-03-27 21:58:10 -05:00
411c71e900
cargo fmt
2018-03-27 21:48:34 -05:00
cc24cceb1a
add test cases
2018-03-27 21:48:29 -05:00
fcdb0c6b87
simpler way of doing it
2018-03-27 21:39:15 -05:00
5fabbc91d5
If there is no prefix, default to number of bits ipv4/32, ipv6/128
2018-03-27 21:36:39 -05:00
c9e25e15fa
Add Serde Feature for IpNetwork
2018-03-14 19:00:38 -07:00
a3528a8f43
Another round of formatting
2017-12-21 17:45:45 +00:00
124330be88
avoid misleading message
...
Closes #61
2017-10-09 11:59:48 +02:00
8ee7f2d1ed
Add two tests for send and sync
...
To prevent future regressions as the library evolves
2017-09-22 17:56:43 +01:00
9db3d5c30d
add From<IpAddr> for IpNetwork
2017-08-22 15:15:18 +00:00
910a52b64b
Add a size method for Ipv6Network
2017-07-11 21:21:00 +01:00
2ee819a438
Add a broadcast method for Ipv6Network
2017-07-11 21:11:39 +01:00
1171e5ae94
Add a network method for Ipv6Network
2017-07-11 21:01:41 +01:00
99203160b9
Add an iterator for ipv6 network. ( #49 )
...
This is feature gated since i128 is not stable yet
2017-07-08 20:28:00 +01:00
ab7d5b32d0
Add PartialOrd and Ord instances for network types.
2017-05-16 10:34:11 +00:00
c11ebdbd5b
Docs update
2016-12-21 17:56:17 +00:00