Skip to content

Commit 27ffb5c

Browse files
committed
refactor: Rename features of optional functionality to match crates
BREAKING CHANGE: This is breaking since features are being renamed
1 parent 09f1090 commit 27ffb5c

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515

1616

1717
## [Unreleased]
18+
### Changed
19+
- Rename the "ipnet" feature to "ipnetwork" to match the dependency.
20+
- Rename the "mac" feature to "macaddr" to match the dependency.
1821

1922

2023
## [0.2.0] - 2025-05-11

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ proc-macro = true
1818
## By default, only generate stdlib types
1919
default = []
2020
## enables generation of [`ipnetwork`] types
21-
ipnet = ["dep:ipnetwork"]
21+
ipnetwork = ["dep:ipnetwork"]
2222
## enables generation of [`macaddr`] types
23-
mac = ["dep:macaddr"]
23+
macaddr = ["dep:macaddr"]
2424

2525
[dependencies]
2626
cfg-if = "1"

src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ make_macro! {
183183
// IpNetwork types
184184

185185
cfg_if::cfg_if! {
186-
if #[cfg(feature = "ipnet")] {
186+
if #[cfg(feature = "ipnetwork")] {
187187
use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
188188

189189
make_macro!{
@@ -198,7 +198,7 @@ cfg_if::cfg_if! {
198198
quote! { ipnetwork::IpNetwork::V6(#inner) }
199199
}
200200
};
201-
"ipnet"
201+
"ipnetwork"
202202
}
203203

204204
make_macro!{
@@ -208,7 +208,7 @@ cfg_if::cfg_if! {
208208
let prefix = net.prefix();
209209
quote! { ipnetwork::Ipv4Network::new_checked(#ip, #prefix).unwrap() }
210210
};
211-
"ipnet"
211+
"ipnetwork"
212212
}
213213

214214

@@ -219,15 +219,15 @@ cfg_if::cfg_if! {
219219
let prefix = net.prefix();
220220
quote! { ipnetwork::Ipv6Network::new_checked(#ip, #prefix).unwrap() }
221221
};
222-
"ipnet"
222+
"ipnetwork"
223223
}
224224
}
225225
}
226226

227227
// MacAddr types
228228

229229
cfg_if::cfg_if! {
230-
if #[cfg(feature = "mac")] {
230+
if #[cfg(feature = "macaddr")] {
231231
use macaddr::{MacAddr, MacAddr6, MacAddr8};
232232

233233
make_macro!{
@@ -242,7 +242,7 @@ cfg_if::cfg_if! {
242242
quote! { macaddr::MacAddr::V8(#inner) }
243243
}
244244
};
245-
"mac"
245+
"macaddr"
246246
}
247247

248248
make_macro! {
@@ -251,7 +251,7 @@ cfg_if::cfg_if! {
251251
let bytes = addr.into_array();
252252
quote! { macaddr::MacAddr6::new(#(#bytes),*) }
253253
};
254-
"mac"
254+
"macaddr"
255255
}
256256

257257
make_macro!{
@@ -260,7 +260,7 @@ cfg_if::cfg_if! {
260260
let bytes = addr.into_array();
261261
quote! { macaddr::MacAddr8::new(#(#bytes),*) }
262262
};
263-
"mac"
263+
"macaddr"
264264
}
265265
}
266266
}
@@ -278,13 +278,13 @@ mod tests {
278278
t.compile_fail("tests/fail/sock4.rs");
279279
t.compile_fail("tests/fail/sock6.rs");
280280

281-
if cfg!(feature = "ipnet") {
281+
if cfg!(feature = "ipnetwork") {
282282
t.compile_fail("tests/fail/net.rs");
283283
t.compile_fail("tests/fail/net4.rs");
284284
t.compile_fail("tests/fail/net6.rs");
285285
}
286286

287-
if cfg!(feature = "mac") {
287+
if cfg!(feature = "macaddr") {
288288
t.compile_fail("tests/fail/mac.rs");
289289
t.compile_fail("tests/fail/mac6.rs");
290290
t.compile_fail("tests/fail/mac8.rs");
@@ -297,13 +297,13 @@ mod tests {
297297
t.pass("tests/pass/sock4.rs");
298298
t.pass("tests/pass/sock6.rs");
299299

300-
if cfg!(feature = "ipnet") {
300+
if cfg!(feature = "ipnetwork") {
301301
t.pass("tests/pass/net.rs");
302302
t.pass("tests/pass/net4.rs");
303303
t.pass("tests/pass/net6.rs");
304304
}
305305

306-
if cfg!(feature = "mac") {
306+
if cfg!(feature = "macaddr") {
307307
t.pass("tests/pass/mac.rs");
308308
t.pass("tests/pass/mac6.rs");
309309
t.pass("tests/pass/mac8.rs");

0 commit comments

Comments
 (0)