Skip to content

Commit

Permalink
const-oid: make length the first field of ObjectIdentifier (#178)
Browse files Browse the repository at this point in the history
This primarily impacts how the derived `PartialOrd`/`Ord` impls behave.

It ensures that the longer OID is always greater.
  • Loading branch information
tarcieri committed Nov 3, 2021
1 parent 73b4939 commit a485456
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions const-oid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ use core::{fmt, str::FromStr};
/// [`ObjectIdentifier::MAX_SIZE`]
#[derive(Copy, Clone, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub struct ObjectIdentifier {
/// Array containing BER/DER-serialized bytes (no header)
bytes: [u8; Self::MAX_SIZE],

/// Length in bytes
length: u8,

/// Array containing BER/DER-serialized bytes (no header)
bytes: [u8; Self::MAX_SIZE],
}

#[allow(clippy::len_without_is_empty)]
Expand Down

0 comments on commit a485456

Please sign in to comment.