pub trait SafeUnwrap<T> {
// Required methods
fn safe_unwrap(&self) -> &T;
fn safe_unwrap_mut(&mut self) -> &mut T;
}
Expand description
Trait implemented to unwrap optional parse tree items initially introduced in hyperledger/solang#1068.
Note that the methods of this trait should only be used on parse tree items’ fields, like
[pt::VariableDefinition] or [pt::EventDefinition], where the name
field is None
only when an
error occurred during parsing.
Required Methods§
Sourcefn safe_unwrap(&self) -> &T
fn safe_unwrap(&self) -> &T
See SafeUnwrap.
Sourcefn safe_unwrap_mut(&mut self) -> &mut T
fn safe_unwrap_mut(&mut self) -> &mut T
See SafeUnwrap.