use core::convert::TryFrom;
use der::{asn1::Any, Encodable, Encoder, Length};
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
pub struct Attributes<'a>(Any<'a>);
impl<'a> From<Attributes<'a>> for Any<'a> {
fn from(attrs: Attributes<'a>) -> Any<'a> {
attrs.0
}
}
impl<'a> TryFrom<Any<'a>> for Attributes<'a> {
type Error = der::Error;
fn try_from(any: Any<'a>) -> der::Result<Attributes<'a>> {
Ok(Attributes(any))
}
}
impl<'a> Encodable for Attributes<'a> {
fn encoded_len(&self) -> der::Result<Length> {
self.0.encoded_len()
}
fn encode(&self, encoder: &mut Encoder<'_>) -> der::Result<()> {
self.0.encode(encoder)
}
}