/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
usesuper::Cryptographer; use once_cell::sync::OnceCell;
/// Sets the global object that will be used for cryptographic operations. /// /// This is a convenience wrapper over [`set_cryptographer`], /// but takes a `Box<dyn Cryptographer>` instead. #[cfg(not(feature = "backend-openssl"))] pubfn set_boxed_cryptographer(c: Box<dyn Cryptographer>) -> Result<(), SetCryptographerError> { // Just leak the Box. It wouldn't be freed as a `static` anyway, and we // never allow this to be re-assigned (so it's not a meaningful memory leak).
set_cryptographer(Box::leak(c))
}
/// Sets the global object that will be used for cryptographic operations. /// /// This function may only be called once in the lifetime of a program. /// /// Any calls into this crate that perform cryptography prior to calling this /// function will panic. pubfn set_cryptographer(c: &'static dyn Cryptographer) -> Result<(), SetCryptographerError> {
CRYPTOGRAPHER.set(c).map_err(|_| SetCryptographerError(()))
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.