Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generated enum types mismatch when imported #68

Open
schphil opened this issue Dec 9, 2024 · 0 comments
Open

generated enum types mismatch when imported #68

schphil opened this issue Dec 9, 2024 · 0 comments

Comments

@schphil
Copy link

schphil commented Dec 9, 2024

When generating rust code for DSRC-region.asn the enums types are suffixed with _Type.

    use core::borrow::Borrow;
    use lazy_static::lazy_static;
    use rasn::prelude::*;
    #[derive(Debug, Clone, PartialEq)]
    pub enum RegAdvisorySpeed_Type {}
    impl RegAdvisorySpeed_Type {
        pub fn decode<D: Decoder>(
            decoder: &mut D,
            open_type_payload: Option<&Any>,
            identifier: &RegionId,
        ) -> Result<Self, D::Error> {
            match identifier {
                _ => Err(rasn::error::DecodeError::from_kind(
                    rasn::error::DecodeErrorKind::Custom {
                        msg: alloc::format!(
                            "Unknown unique identifier for information object class instance."
                        ),
                    },
                    decoder.codec(),
                )
                .into()),
            }
        }
        pub fn encode<E: Encoder>(
            &self,
            encoder: &mut E,
            identifier: &RegionId,
        ) -> Result<(), E::Error> {
            match (self, identifier) {
                _ => Err(rasn::error::EncodeError::from_kind(
                    rasn::error::EncodeErrorKind::Custom {
                        msg: alloc::format!(
                            "Unknown unique identifier for information object class instance."
                        ),
                    },
                    encoder.codec(),
                )
                .into()),
            }
        }
    }

However when imported in DRSC.asn the suffix misses:

pub mod etsi__its__dsrc {
   extern crate alloc;
   use super::super::etsi_its_cdd::etsi__its__cdd::{Iso3833VehicleType, Latitude, Longitude, StationID};
   use super::etsi__its__dsrc__region::{
       RegAdvisorySpeed, RegComputedLane, RegConnectionManeuverAssist, RegGenericLane,
       RegIntersectionGeometry, RegIntersectionState, RegLaneAttributes, RegLaneDataAttribute,
       RegMapData, RegMovementEvent, RegMovementState, RegNodeAttributeSetXY,
       RegNodeOffsetPointXY, RegPosition3D, RegRTCMcorrections, RegRequestorDescription,
       RegRequestorType, RegRestrictionUserType, RegRoadSegment, RegSPAT, RegSignalControlZone,
       RegSignalRequest, RegSignalRequestMessage, RegSignalRequestPackage, RegSignalStatus,
       RegSignalStatusMessage, RegSignalStatusPackage,
   };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant