From 0a8c0daa9f48093682a3197ad24d37c16dc32c99 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sat, 10 Aug 2019 14:19:38 -0400 Subject: Use endpoint's max packet size for pipe. --- src/pipe/pck_size.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/pipe/pck_size.rs') diff --git a/src/pipe/pck_size.rs b/src/pipe/pck_size.rs index acc499f..c95140d 100644 --- a/src/pipe/pck_size.rs +++ b/src/pipe/pck_size.rs @@ -29,6 +29,16 @@ impl PckSize { f(&mut w); self.0 = w.bits; } + + pub fn modify(&mut self, f: F) + where + for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W, + { + let r = R { bits: self.0 }; + let mut w = W { bits: self.0 }; + f(&r, &mut w); + self.0 = w.bits; + } } impl From for PckSize { -- cgit v1.2.3