Description Usage Arguments Details Value Functions Examples
Returns the value contained inside of an enum variant. The function strips all relevant attributes from the object, returning its bare value.
1 2 3 |
x |
Enumerated value to unwrap |
... |
objects to be passed to methods. |
alt |
Alternative value to be returned in case of failure |
unwrap
is used to extract the inside objects of an Enum. Unless the Enum was assigned a specific
value, the returned value will be a list with names equal to those in the Enum declaration.
Result
and Option
have associated unwrap
methods that automatically
call an error and stop execution if the variant is either Err(e)
or None
, respectively.
unwrap_or
allows the user to specify an alternative value in case of failure on the part of
Result
or Option
.
an object of any class.
unwrap_or
: Extract the inside of Enum. If variant is 'Err' or 'None', the alternative is returned.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.