mac: Support parsing hyphen-separated addresses
Windows utilities typically display MAC addresses formatted with hyphens separating the octets. Natively supporting parsing these representations makes it easier for users to simply paste them, without having to manually change the hyphens to colons.master
parent
989a6eb0e6
commit
823cfc2593
|
@ -45,7 +45,7 @@ pub struct MacAddress {
|
|||
|
||||
impl MacAddress {
|
||||
pub fn from_string(s: &str) -> Result<Self, ParseError> {
|
||||
let split: Result<Vec<_>, _> = s.split(":")
|
||||
let split: Result<Vec<_>, _> = s.split(|c| c == ':' || c == '-')
|
||||
.map(|b| u8::from_str_radix(b, 16))
|
||||
.collect();
|
||||
match split {
|
||||
|
|
Loading…
Reference in New Issue