Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ serde_std = ["std", "serde/std"]
serde = { version = "^1.0", default-features = false, features = ["derive"], optional = true }

[dev-dependencies]
assert_matches = "1.3.0"
assert_matches = "1.5.0"

[package.metadata.docs.rs]
features = ["serde", "serde_std"]
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "Two"
wrap_comments = true
comment_width = 120
max_width = 120
merge_imports = false
imports_granularity="Preserve"
newline_style = "Unix"
struct_lit_single_line = false
6 changes: 3 additions & 3 deletions src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl MacAddr {
/// assert_eq!(addr.is_v6(), true);
/// assert_eq!(addr.is_v8(), false);
/// ```
pub fn is_v6(&self) -> bool {
pub const fn is_v6(&self) -> bool {
match self {
MacAddr::V6(_) => true,
MacAddr::V8(_) => false,
Expand All @@ -39,7 +39,7 @@ impl MacAddr {
/// assert_eq!(addr.is_v6(), false);
/// assert_eq!(addr.is_v8(), true);
/// ```
pub fn is_v8(&self) -> bool {
pub const fn is_v8(&self) -> bool {
match self {
MacAddr::V6(_) => false,
MacAddr::V8(_) => true,
Expand All @@ -58,7 +58,7 @@ impl MacAddr {
///
/// assert_eq!(addr.as_bytes(), &[0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);
/// ```
pub fn as_bytes(&self) -> &[u8] {
pub const fn as_bytes(&self) -> &[u8] {
match self {
MacAddr::V6(addr) => addr.as_bytes(),
MacAddr::V8(addr) => addr.as_bytes(),
Expand Down
2 changes: 1 addition & 1 deletion src/addr6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl MacAddr6 {
///
/// assert_eq!(addr.as_bytes(), &[0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);
/// ```
pub fn as_bytes(&self) -> &[u8] {
pub const fn as_bytes(&self) -> &[u8] {
&self.0
}

Expand Down
2 changes: 1 addition & 1 deletion src/addr8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl MacAddr8 {
///
/// assert_eq!(addr.as_bytes(), &[0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67, 0x89, 0xAB]);
/// ```
pub fn as_bytes(&self) -> &[u8] {
pub const fn as_bytes(&self) -> &[u8] {
&self.0
}

Expand Down
6 changes: 3 additions & 3 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{MacAddr, MacAddr6, MacAddr8};
/// An error which can be returned when parsing MAC address.
///
/// This error is used as the error type for the `FromStr` implementation
/// for [MacAddr6] and [MacAddr8].
/// for [`MacAddr6`] and [`MacAddr8`].
///
/// [MacAddr6]: ./struct.MacAddr6.html
/// [MacAddr8]: ./struct.MacAddr8.html
Expand Down Expand Up @@ -62,15 +62,15 @@ pub struct Parser<'a> {
}

impl<'a> Parser<'a> {
pub fn new(s: &'a str) -> Parser<'a> {
pub const fn new(s: &'a str) -> Parser<'a> {
Parser {
source: s.as_bytes(),
pos: 0,
delimiter: None,
}
}

fn is_eof(&self) -> bool {
const fn is_eof(&self) -> bool {
self.pos == self.source.len()
}

Expand Down