aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe/pck_size.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pipe/pck_size.rs')
-rw-r--r--src/pipe/pck_size.rs10
1 files changed, 10 insertions, 0 deletions
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<F>(&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<u32> for PckSize {