402 Commits

Author SHA1 Message Date
c3af07d69a Impl From<Ipv4Addr, Ipv6Addr> for IpNetwork (#218) 2025-03-22 15:30:10 -05:00
35977adc81 Iterator size hints (#217)
* feat: iterator size hints

* fix: add size_hint to IpNetworkIterator
2025-02-28 10:00:56 -06:00
0deb2abd8b Add ip_mask_to_prefix_checked (#214)
* Add `ipv4_mask_to_prefix_checked`

* Add `ipv6_mask_to_prefix_checked`

* Add `ip_mask_to_prefix_checked`
2025-01-12 22:04:28 -06:00
170fc4ca6b Add rust-version to Cargo.toml and set MSRV to 1.80.0 (#215) 2025-01-12 22:03:05 -06:00
aa65f088b1 Make IpNetwork::is_ipv4 and IpNetwork::is_ipv6 const (#213) 2025-01-09 13:06:22 -06:00
5f929258ef Make IpNetwork::ip const (#212) 2025-01-08 17:38:34 -06:00
a21f5df04e Make IpNetwork::broadcast const (#211) 2025-01-08 17:38:16 -06:00
876f882523 Make IpNetwork::network const (#210) 2025-01-08 17:37:32 -06:00
49f07a4838 Make IpNetwork::prefix const (#209) 2025-01-08 17:36:53 -06:00
2f219a2ada Make IpNetwork::contains const (#208)
* Make `Ipv6Network::contains` const

* Make `Ipv4Network::contains` const

* Make `IpNetwork::contains` const
2025-01-08 10:22:33 -06:00
9ae719637d Make IpNetwork::mask const (#207)
* Make `Ipv4Network::mask` const

* Make `Ipv6Network::mask` const

* Make `IpNetwork::mask` const
2025-01-07 21:03:10 -06:00
c2812a91a8 chore: release v0.21.1 (#206)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.21.1
2025-01-07 12:55:55 -06:00
e1d3ac6de1 Fix for 0::/0 network (#205) 2025-01-06 22:13:12 -06:00
551d1a62b1 chore: release v0.21.0 (#204)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.21.0
2025-01-05 21:59:39 -06:00
285cf9d409 Update rust.yml 2025-01-05 21:41:07 -06:00
ea467bb744 Update .gitignore 2025-01-05 21:30:56 -06:00
209d5432a6 Update publish.yml 2025-01-05 21:28:23 -06:00
16095cb510 Update publish.yml 2025-01-05 21:23:27 -06:00
4f7d898a86 Replace Ipv{4,6}Network::new_unchecked with Ipv{4,6}Network::new_checked (#203)
* Replace `Ipv4Network::new_unchecked` with `Ipv4Network::new_checked`

* Replace `Ipv6Network::new_unchecked` with `Ipv6Network::new_checked`

* Update doc test for `Ipv{4,6}Network::new_checked` to use `should_panic`

* Better demonstrate use of `Ipv{4,6}Network::new_checked` in const contexts

* Add back `unsafe_code` lint at the deny level
2025-01-05 21:19:04 -06:00
d665bb6beb Make the serde feature opt-in instead of opt-out (#200)
Most people add dependencies without checking their features
or optional dependencies too carefully. This leads to them pulling in
transitive dependencies they likely don't need.
2024-09-24 10:40:42 -05:00
ad46759a55 fix for 0.0.0.0/0 network (#199) 2024-09-07 14:22:12 -05:00
dsx
cbf8d6b29a Fix typo (#198) 2024-08-09 20:53:42 -05:00
7e0519cd35 fix(deps): update rust crate serde to 1.0.200 (#196)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-01 12:44:19 -05:00
83a62c9605 Update publish.yml (#195) 2024-05-01 09:12:06 -05:00
c840f27855 chore(deps): update rust crate serde_json to 1.0.116 (#193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-01 09:10:53 -05:00
4b16661585 fix(deps): update rust crate serde to 1.0.199 (#194)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-01 09:10:23 -05:00
a0831a77b9 chore: setup release plz (#192) 2024-04-30 21:59:49 -05:00
f0fd0521e1 fix: use associated constants (#191) 2024-04-30 21:49:56 -05:00
bb51dee73a Update Rust crate criterion to 0.5.1 (#172)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-30 21:43:09 -05:00
b5f5b79d23 Update actions/checkout action to v4 (#182)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-30 21:42:39 -05:00
70d1f74e29 ipv6: rewrite core ipv6 methods to operate on u128s (#187)
* errors: adds `From<AddrParseError>` for `IpNetworkError`

* ipv4: adds safety comment to `new_unchecked` and debug assertions to verify compliance

* ipv6: rewrite core ipv6 methods to operate on `u128`s
2024-04-30 21:41:17 -05:00
068959e2c4 github: move to dtolnay/rust-toolchain and run clippy (#189) 2024-04-29 22:25:29 -05:00
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
6e32dd2e88 Update Rust crate schemars to 0.8.17 (#184)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-28 13:42:11 -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
817b5babed Update Rust crate schemars to 0.8.15 (#183)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-18 12:04:15 -05:00
9bf407e634 Update Rust crate schemars to 0.8.13 (#181)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-28 19:09:51 -05: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
19aafee3c8 Update criterion requirement from 0.4.0 to 0.5.0
Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.4.0...0.5.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-24 20:33:33 -05:00
a01d32ede8 Update katyo/publish-crates action to v2 2023-04-23 19:53:43 -05:00
b4c0554d11 Update actions/checkout action to v3 2023-04-23 19:53:26 -05:00
3a2d1da053 Update Rust crate schemars to 0.8.12 2023-04-23 19:53:07 -05:00
98914649d6 Add renovate.json 2023-04-23 15:04:05 -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