pub enum SthResult {
Ok(SignedTreeHead),
Err(Error),
ErrWithSth(Error, SignedTreeHead),
}Expand description
Either a fetched and checked SignedTreeHead, or a SignedTreeHead that has a valid signature
but did not pass some internal checks, or just an Error.
Variants§
Ok(SignedTreeHead)
Got the new tree head.
Err(Error)
Something went wrong and no tree head was received.
ErrWithSth(Error, SignedTreeHead)
Something went wrong, but the server returned a valid signed tree head. The underlying error is wrapped inside. You may wish to log this.
Implementations§
Source§impl SthResult
impl SthResult
Sourcepub fn tree_head(&self) -> Option<&SignedTreeHead>
pub fn tree_head(&self) -> Option<&SignedTreeHead>
Return a signed tree head, if there is one received.
This can return a Some even when there is error, if for example, the server returned a valid signed
tree head but failed to provide a consistency proof. You may wish to log this.
pub fn is_ok(&self) -> bool
pub fn is_err(&self) -> bool
Sourcepub fn unwrap(self) -> SignedTreeHead
pub fn unwrap(self) -> SignedTreeHead
Return the SignedTreeHead, if this is a Ok. Otherwise panic.
Sourcepub fn unwrap_err(self) -> Error
pub fn unwrap_err(self) -> Error
Return the Error, if this is an Err or ErrWithSth. Otherwise panic.
Sourcepub fn unwrap_tree_head(self) -> SignedTreeHead
pub fn unwrap_tree_head(self) -> SignedTreeHead
Return the SignedTreeHead, if this is a Ok or ErrWithSth. Otherwise panic.