mirror of
https://github.com/GyulyVGC/sniffnet.git
synced 2026-08-04 14:51:37 +00:00
Merge pull request #1232 from LeandroPG19/perf/presize-mac-string
perf: pre-size mac_from_dec_to_hex String with capacity
This commit is contained in:
commit
7622d415ba
1 changed files with 1 additions and 1 deletions
|
|
@ -492,7 +492,7 @@ pub fn is_my_address(local_address: &IpAddr, my_interface_addresses: &Vec<Addres
|
|||
|
||||
/// Converts a MAC address in its hexadecimal form
|
||||
fn mac_from_dec_to_hex(mac_dec: [u8; 6]) -> String {
|
||||
let mut mac_hex = String::new();
|
||||
let mut mac_hex = String::with_capacity(17);
|
||||
for n in &mac_dec {
|
||||
let _ = write!(mac_hex, "{n:02x}:");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue