Skip to content

Commit

Permalink
Merge pull request #142 from ammubhave/const
Browse files Browse the repository at this point in the history
fields.rs: Make request_type function a const fn
  • Loading branch information
a1ien authored Aug 25, 2022
2 parents bbd4d67 + b3d3eed commit 17fe36f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ impl std::fmt::Display for Version {
///
/// rusb::request_type(Direction::In, RequestType::Standard, Recipient::Device);
/// ```
pub fn request_type(direction: Direction, request_type: RequestType, recipient: Recipient) -> u8 {
pub const fn request_type(
direction: Direction,
request_type: RequestType,
recipient: Recipient,
) -> u8 {
let mut value: u8 = match direction {
Direction::Out => LIBUSB_ENDPOINT_OUT,
Direction::In => LIBUSB_ENDPOINT_IN,
Expand Down

0 comments on commit 17fe36f

Please # to comment.