Skip to content

Commit

Permalink
add convenient mask key conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
zephyrchien committed Apr 14, 2022
1 parent 26d991e commit d62f279
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/frame/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ impl Mask {
None => 0x00,
}
}

/// Get inner mask key.
#[inline]
pub const fn to_key(&self) -> [u8; 4] {
use Mask::*;
match self {
Key(k) => *k,
Skip => [0u8; 4],
None => unreachable!(),
}
}
}

/// Generate a new random mask key.
Expand Down

0 comments on commit d62f279

Please sign in to comment.