File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,12 @@ impl WorkBuilder {
174
174
}
175
175
}
176
176
177
+ /// Calculate the memory needed by scheduled work. This does not include the size of the Answer
178
+ /// (which can be dropped).
179
+ pub fn work_size < F : Future > ( f : F ) -> usize {
180
+ WorkData :: size_of ( f)
181
+ }
182
+
177
183
/// A potentially running Work.
178
184
///
179
185
/// This encapsulates a Future that is potentially running in the Zephyr work queue system.
@@ -535,6 +541,13 @@ impl<F: Future> WorkData<F> {
535
541
let this = Box :: from_raw ( ptr) ;
536
542
Pin :: new_unchecked ( this)
537
543
}
544
+
545
+ /// Determine the size of WorkData for a given Future.
546
+ ///
547
+ /// It is difficult to otherwise calculate this. The future will be dropped by this.
548
+ pub fn size_of ( _: F ) -> usize {
549
+ mem:: size_of :: < Self > ( )
550
+ }
538
551
}
539
552
540
553
/// A VoidWaker is used when we don't use the Waker mechanism. There is no data associated with
You can’t perform that action at this time.
0 commit comments