added panic doc
This commit is contained in:
parent
c2ee4c63f5
commit
546db20934
|
@ -41,6 +41,8 @@ impl WolPacket {
|
||||||
/// extern crate wakey;
|
/// extern crate wakey;
|
||||||
/// let wol = wakey::WolPacket::from_string("00:01:02:03:04:05", ':');
|
/// 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)
|
||||||
pub fn from_string(data: &str, sep: char) -> WolPacket {
|
pub fn from_string(data: &str, sep: char) -> WolPacket {
|
||||||
WolPacket::from_bytes(&WolPacket::mac_to_byte(data, sep))
|
WolPacket::from_bytes(&WolPacket::mac_to_byte(data, sep))
|
||||||
}
|
}
|
||||||
|
@ -80,6 +82,7 @@ impl WolPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts string representation of MAC address (e.x. 00:01:02:03:04:05) to raw bytes.
|
/// Converts string representation of MAC address (e.x. 00:01:02:03:04:05) to raw bytes.
|
||||||
|
/// # Panic
|
||||||
/// Panics when input MAC is invalid (i.e. contains non-byte characters)
|
/// Panics when input MAC is invalid (i.e. contains non-byte characters)
|
||||||
fn mac_to_byte(data: &str, sep: char) -> Vec<u8> {
|
fn mac_to_byte(data: &str, sep: char) -> Vec<u8> {
|
||||||
data.split(sep)
|
data.split(sep)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user