[#util-Expected-0b]
= xref:util.adoc[util]::Expected
:relfileprefix: ../
:mrdocs:

The util&colon;&colon;Expected class provides a standard way for low&hyphen;level functions to return either error values or result values&period;

== Synopsis

Declared in `&lt;util&sol;expected&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class T,
    class E&gt;
class Expected;
----

== Description

It provides a smaller version of std&colon;&colon;expected from C&plus;&plus;23&period; Missing features can be added, if needed&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:util/Expected-0b/2constructor-05.adoc[`Expected`]         [.small]#[constructor]#
| Constructors
| xref:util/Expected-0b/error-0af.adoc[`error`] 
| Access the stored error (undefined behavior if a value is held)&period;
| xref:util/Expected-0b/has_value.adoc[`has&lowbar;value`] 
| Test whether a result value is held&period;
| xref:util/Expected-0b/operator_star-04.adoc[`operator&ast;`] 
| Access the result value without checking&period;
| xref:util/Expected-0b/operator_ptr-046.adoc[`operator&hyphen;&gt;`] 
| Access members of the result value&period;
| xref:util/Expected-0b/swap.adoc[`swap`] 
| Swap contents with another Expected&period;
| xref:util/Expected-0b/value-05.adoc[`value`] 
| Access the result value, throwing if an error is held&period;
| xref:util/Expected-0b/value_or-0c.adoc[`value&lowbar;or`] 
| Return the result value, or a fallback when an error is held&period;
| xref:util/Expected-0b/2conversion.adoc[`operator bool`] 
| Test whether a result value is held&period;
|===


== Specializations

[cols="1"]
|===
| Name
| xref:util/Expected-05.adoc[`Expected&lt;void, E&gt;`] 
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:FeeRateEstimationRef.adoc[`&colon;&colon;FeeRateEstimationRef`]
| Return the estimation carried by a fee rate estimate result&colon; the successful estimation, or the error&apos;s zero&hyphen;value estimation&period;
| xref:ParseKeyPathElement.adoc[`&colon;&colon;ParseKeyPathElement`]
| Parse a single key path element like &quot;0&quot;, &quot;0&apos;&quot;, or &quot;0h&quot;&period; Returns the derivation index and hardened status, or an error message&period;
| xref:SignPSBTInput.adoc[`&colon;&colon;SignPSBTInput`]
| Signs a PSBTInput, verifying that all provided data matches what is being signed&period;
| xref:wallet/ExportDescriptors.adoc[`&colon;&colon;wallet&colon;&colon;ExportDescriptors`]
| Export the descriptors from a wallet so that they can be imported elsewhere
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
