Skip to content

Commit

Permalink
Updated crates and range syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
KizzyCode committed Oct 12, 2019
1 parent 7fc4a01 commit 0702439
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "asn1_der"
version = "0.6.2"
version = "0.6.3"
authors = ["KizzyCode Software Labs./Keziah Biermann <development@kizzycode.de>"]
description = "This crate provides a simple ASN.1-DER en-/decoder"
license = "BSD-2-Clause OR MIT"
Expand All @@ -26,7 +26,7 @@ overflow-checks = true

[dependencies.asn1_der_derive]
optional = true
version = "0.1.1"
version = "0.1.2"
path = "./asn1_der_derive"


Expand Down
6 changes: 3 additions & 3 deletions src/der/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl DerLength {
pub fn deserialize<'a>(mut source: impl Iterator<Item = &'a u8>) -> Result<Self, Asn1DerError> {
match *source.next().ok_or(Asn1DerError::LengthMismatch)? as usize {
// Decode simple length
b @ 0...127 => Ok(Self{ len: b }),
b @ 0..=127 => Ok(Self{ len: b }),

// Decode complex length
b => match b & 0x0f {
Expand All @@ -40,7 +40,7 @@ impl DerLength {
pub fn serialized_len(&self) -> usize {
match self.len {
// Simple length
0...127 => 1,
0..=127 => 1,
// Complex length
len => 1 + USIZE_LEN - (len.leading_zeros() / 8) as usize
}
Expand All @@ -52,7 +52,7 @@ impl DerLength {
let serialized_len = self.serialized_len();
match self.len {
// Encode simple length
len @ 0...127 => *buf.next().ok_or(Asn1DerError::LengthMismatch)? = len as u8,
len @ 0..=127 => *buf.next().ok_or(Asn1DerError::LengthMismatch)? = len as u8,

// Encode complex length
len => {
Expand Down

0 comments on commit 0702439

Please sign in to comment.