I am currently working in the context of SUPL, where the rasn compiler generated these pieces:
#[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, identifier = "MCC-MNC-Digit", value("0..=9"))]
pub struct MCCMNCDigit(pub u8);
#[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, size("2..=3"))]
pub struct MNC(pub SequenceOf<MCCMNCDigit>);
This was used in a larger context, and I had a failure on an attemt to use rasn::uper::encode.
The error I get was looking like this:
EncodeError { kind: InvalidLength { length: 0, expected: Range { start: Some(2), end: Some(3) } }, codec: Uper, backtrace: Backtrace(()) }
For the error itself this information is certainly correct, but in using this it is insufficient. It took me quite some time to get the information, that the MNC declaration was behind this length constraint.
I traced it back to encode_with_tag_and_constraints in which I found the required information. I suggest to enrich the error information at this point to improve it's usability.
I am currently working in the context of SUPL, where the rasn compiler generated these pieces:
This was used in a larger context, and I had a failure on an attemt to use
rasn::uper::encode.The error I get was looking like this:
For the error itself this information is certainly correct, but in using this it is insufficient. It took me quite some time to get the information, that the MNC declaration was behind this length constraint.
I traced it back to
encode_with_tag_and_constraintsin which I found the required information. I suggest to enrich the error information at this point to improve it's usability.