Struct wakey::WolPacket

source ·
pub struct WolPacket { /* private fields */ }
Expand description

Wake-on-LAN packet

Implementations§

Creates WOL packet from byte MAC representation

Example
let wol = wakey::WolPacket::from_bytes(&vec![0x00, 0x01, 0x02, 0x03, 0x04, 0x05]);

Creates WOL packet from string MAC representation (e.x. 00:01:02:03:04:05)

Example
let wol = wakey::WolPacket::from_string("00:01:02:03:04:05", ':');
Panic

Panics when input MAC is invalid (i.e. contains non-byte characters)

Broadcasts the magic packet from / to default address Source: 0.0.0.0:0 Destination 255.255.255.255:9

Example
let wol = wakey::WolPacket::from_bytes(&vec![0x00, 0x01, 0x02, 0x03, 0x04, 0x05]).unwrap();
wol.send_magic();

Broadcasts the magic packet from / to specified address.

Example
use std::net::SocketAddr;
let wol = wakey::WolPacket::from_bytes(&vec![0x00, 0x01, 0x02, 0x03, 0x04, 0x05]).unwrap();
let src = SocketAddr::from(([0,0,0,0], 0));
let dst = SocketAddr::from(([255,255,255,255], 9));
wol.send_magic_to(src, dst);

Returns the underlying WoL packet bytes

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.