| Crates.io | vlan |
| lib.rs | vlan |
| version | 0.1.2 |
| created_at | 2025-10-11 15:53:16.896596+00 |
| updated_at | 2025-10-21 12:08:19.776777+00 |
| description | Clean VLAN ID representation with transparent u16 support, an invalid VLAN Error type, and a value that represents a native VLAN. |
| homepage | https://github.com/metastable-void/vlan-rs |
| repository | https://github.com/metastable-void/vlan-rs |
| max_upload_size | |
| id | 1878314 |
| size | 42,647 |
Clean VLAN ID representation with transparent u16 support, an invalid VLAN Error type, and a value that represents a native VLAN.
use vlan::MaybeVlanId;
let native = MaybeVlanId::NATIVE;
assert_eq!(native, MaybeVlanId::try_new(0u16).unwrap());
assert!(MaybeVlanId::try_new(4095).is_err());
// memory-level compatibility with u16!
let zero: u16 = 0u16;
let should_be_zero: u16 = unsafe { std::mem::transmute(MaybeVlanId::NATIVE) };
assert_eq!(zero, should_be_zero);
Apache 2.0 or MPL 2.0.