//! //! Abstract data types. //! use crate::Secret; /// Interface to expose a reference to an inner secret pub trait PeekInterface { /// Only method providing access to the secret value. fn peek(&self) -> &S; } /// Interface that consumes a option secret and returns the value. pub trait ExposeOptionInterface { /// Expose option. fn expose_option(self) -> S; } /// Interface that consumes a secret and returns the inner value. pub trait ExposeInterface { /// Consume the secret and return the inner value fn expose(self) -> S; } impl ExposeOptionInterface> for Option> where S: Clone, I: crate::Strategy, { fn expose_option(self) -> Option { self.map(ExposeInterface::expose) } } impl ExposeInterface for Secret where I: crate::Strategy, { fn expose(self) -> S { self.inner_secret } }