• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _module-pw_result:
2
3---------
4pw_result
5---------
6``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.
14
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.
19
20Compatibility
21=============
22Works with C++11, but some features require C++17.
23
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
35