diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-10-16 23:23:10 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-16 23:23:10 +0000 |
| commit | 7fd868ade91ebd92cf68016cd40cbbad30a5918e (patch) | |
| tree | d2a94357c0e192a4ec633aaa57b9579f2f2b2922 /embassy-usb/src/descriptor_reader.rs | |
| parent | 6e6df229795e3ff44fc213e03e022bf38f2de47e (diff) | |
| parent | 31d4516516940720101300a40d0d6d2bb8d1728e (diff) | |
Merge pull request #2068 from barafael/const_usb_config_builder_new
Constify UsbDevice Config::new (and clippy fixes) in embassy-usb
Diffstat (limited to 'embassy-usb/src/descriptor_reader.rs')
| -rw-r--r-- | embassy-usb/src/descriptor_reader.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-usb/src/descriptor_reader.rs b/embassy-usb/src/descriptor_reader.rs index 05adcce60..abb4b379e 100644 --- a/embassy-usb/src/descriptor_reader.rs +++ b/embassy-usb/src/descriptor_reader.rs | |||
| @@ -11,11 +11,11 @@ pub struct Reader<'a> { | |||
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | impl<'a> Reader<'a> { | 13 | impl<'a> Reader<'a> { |
| 14 | pub fn new(data: &'a [u8]) -> Self { | 14 | pub const fn new(data: &'a [u8]) -> Self { |
| 15 | Self { data } | 15 | Self { data } |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | pub fn eof(&self) -> bool { | 18 | pub const fn eof(&self) -> bool { |
| 19 | self.data.is_empty() | 19 | self.data.is_empty() |
| 20 | } | 20 | } |
| 21 | 21 | ||
| @@ -102,7 +102,7 @@ pub fn foreach_endpoint(data: &[u8], mut f: impl FnMut(EndpointInfo)) -> Result< | |||
| 102 | } | 102 | } |
| 103 | descriptor_type::ENDPOINT => { | 103 | descriptor_type::ENDPOINT => { |
| 104 | ep.ep_address = EndpointAddress::from(r.read_u8()?); | 104 | ep.ep_address = EndpointAddress::from(r.read_u8()?); |
| 105 | f(ep) | 105 | f(ep); |
| 106 | } | 106 | } |
| 107 | _ => {} | 107 | _ => {} |
| 108 | } | 108 | } |
