diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-02-14 14:06:54 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-02-18 09:44:45 +0100 |
commit | aa9621b29ea345b8013eca4e567eb0cdc9cc93b1 (patch) | |
tree | d4dc1de7d410fcd9b97ecae40e5001a2920c16bc | |
parent | c0675768802d825043931678a89ae3cde3a33149 (diff) |
openpgp: Implement Deref for ComponentBundle.
- Implement `Deref` for `ComponentBundle` so that it derefs to the
containing `Component`.
-rw-r--r-- | openpgp/src/cert/components.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/openpgp/src/cert/components.rs b/openpgp/src/cert/components.rs index 87eaa4c6..dce7d18e 100644 --- a/openpgp/src/cert/components.rs +++ b/openpgp/src/cert/components.rs @@ -3,6 +3,7 @@ use std::cmp::Ordering; use std::slice; use std::time; +use std::ops::Deref; use crate::{ RevocationStatus, @@ -94,6 +95,15 @@ pub struct ComponentBundle<C> { pub(crate) other_revocations: Vec<Signature>, } +impl<C> Deref for ComponentBundle<C> +{ + type Target = C; + + fn deref(&self) -> &Self::Target { + &self.component + } +} + impl<C> ComponentBundle<C> { /// Returns a reference to the component. pub fn component(&self) -> &C { |