blob: bfc37cd4a49b743bf91c402beb8e9afcd28eefb7 [file] [log] [blame]
Wyatt Heplerf9fb90f2020-09-30 18:59:33 -07001.. _module-pw_result:
Alexei Frolov41b32d32019-11-13 17:22:03 -08002
3---------
4pw_result
5---------
Ewout van Bekkum0d04fbc2020-07-23 15:58:04 -07006``pw::Result`` is a convenient wrapper around returning a Status along side some
7data when the status is OK. This is meant for returning lightweight result
8types or references to larger results.
9
10.. warning::
11
12 Be careful not to use larger types by value as this can quickly consume
13 unnecessary stack.
Alexei Frolov41b32d32019-11-13 17:22:03 -080014
15.. warning::
16
17 This module is experimental. Its impact on code size and stack usage has not
18 yet been profiled. Use at your own risk.
Ewout van Bekkum0d04fbc2020-07-23 15:58:04 -070019
20Compatibility
21=============
22Works with C++11, but some features require C++17.
Alexei Frolovde3c2a12020-08-31 10:57:25 -070023
24Size report
25===========
26The table below showcases the difference in size between functions returning a
27Status with an output pointer, and functions returning a Result, in various
28situations.
29
30Note that these are simplified examples which do not necessarily reflect the
31usage of Result in real code. Make sure to always run your own size reports to
32check if Result is suitable for you.
33
34.. include:: result_size