diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-03-01 12:29:54 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-03-01 12:29:54 +0100 |
commit | a05a51c004b6647267025d601c9d8dc3ad9025b7 (patch) | |
tree | e2cf02610bd774548ed9690988d867c8a47fca90 | |
parent | bed057edbf45e989e768e2d8fac5ce7f0619d461 (diff) |
openpgp: Add a function to unwrap a ValidKeyAmgalamtion.
- Add a method to explicitly return the `KeyAmgalamtion` wrapped by
a `ValidKeyAmgalamtion`.
- Although this is possible using `into`, an explicit function makes
it easy to do a second conversion, e.g., a change to the
`KeyAmgalamtion`'s parts or role. Using two `into`s in a row is
not possible. Instead, an intermediate variable with an explicit
type is needed, which is less ergonomic.
-rw-r--r-- | openpgp/src/cert/key_amalgamation.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/openpgp/src/cert/key_amalgamation.rs b/openpgp/src/cert/key_amalgamation.rs index 546b4506..6f221ab9 100644 --- a/openpgp/src/cert/key_amalgamation.rs +++ b/openpgp/src/cert/key_amalgamation.rs @@ -648,6 +648,11 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2> } } + /// Returns the wrapped `KeyAmalgamation`. + pub fn into_key_amalgamation(self) -> KeyAmalgamation<'a, P, R, R2> { + self.ka + } + // NOTE: If you add a method to ValidKeyAmalgamation that takes // ownership of self, then don't forget to write a forwarder for // it for ValidPrimaryKeyAmalgamation. |