pub struct WolPacket { /* private fields */ }Expand description
Wake-on-LAN packet
Implementations§
Source§impl WolPacket
impl WolPacket
Sourcepub fn from_bytes(mac: &[u8]) -> Result<WolPacket>
pub fn from_bytes(mac: &[u8]) -> Result<WolPacket>
Creates WOL packet from byte MAC representation
§Example
let wol = wakey::WolPacket::from_bytes(&vec![0x00, 0x01, 0x02, 0x03, 0x04, 0x05]);Sourcepub fn send_magic(&self) -> Result<()>
pub fn send_magic(&self) -> Result<()>
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();Sourcepub fn send_magic_to<A: ToSocketAddrs>(&self, src: A, dst: A) -> Result<()>
pub fn send_magic_to<A: ToSocketAddrs>(&self, src: A, dst: A) -> Result<()>
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);Sourcepub fn into_inner(self) -> ArrayVec<u8, PACKET_LEN> ⓘ
pub fn into_inner(self) -> ArrayVec<u8, PACKET_LEN> ⓘ
Returns the underlying WoL packet bytes
Trait Implementations§
impl Eq for WolPacket
impl StructuralPartialEq for WolPacket
Auto Trait Implementations§
impl Freeze for WolPacket
impl RefUnwindSafe for WolPacket
impl Send for WolPacket
impl Sync for WolPacket
impl Unpin for WolPacket
impl UnwindSafe for WolPacket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more