open62541 0.10.1

High-level, safe bindings for the C99 library open62541, an open source and free implementation of OPC UA (OPC Unified Architecture).
Documentation
use open62541_sys::UA_CertificateFormat;

/// Wrapper for [`UA_CertificateFormat`] from [`open62541_sys`].
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CertificateFormat(UA_CertificateFormat);

impl CertificateFormat {
    /// [DER] format.
    ///
    /// [DER]: https://en.wikipedia.org/wiki/X.690#DER_encoding
    pub const DER: Self = Self(UA_CertificateFormat::UA_CERTIFICATEFORMAT_DER);

    /// [PEM] format.
    ///
    /// [PEM]: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail
    pub const PEM: Self = Self(UA_CertificateFormat::UA_CERTIFICATEFORMAT_PEM);

    /// Creates copy without giving up ownership.
    #[must_use]
    pub(crate) fn to_raw_copy(this: &Self) -> UA_CertificateFormat {
        // This is safe because the underlying type is trivial (`c_uint`).
        this.0.clone()
    }
}