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