asn1_rs/asn1_types/real/
f64.rs1use crate::{Any, CheckDerConstraints, DerAutoDerive, Error, Real, Result, Tag, Tagged};
2use core::convert::{TryFrom, TryInto};
3
4impl<'a> TryFrom<Any<'a>> for f64 {
5 type Error = Error;
6
7 fn try_from(any: Any<'a>) -> Result<f64> {
8 any.tag().assert_eq(Self::TAG)?;
9 any.header.assert_primitive()?;
10 let real: Real = any.try_into()?;
11 Ok(real.f64())
12 }
13}
14
15impl CheckDerConstraints for f64 {
16 fn check_constraints(any: &Any) -> Result<()> {
17 any.header.assert_primitive()?;
18 any.header.length.assert_definite()?;
19 Ok(())
20 }
21}
22
23impl DerAutoDerive for f64 {}
24
25impl Tagged for f64 {
26 const TAG: Tag = Tag::RealType;
27}