Skip to content

Commit bd43b6e

Browse files
committed
Update CHANGELOG, README and Cargo.toml for v0.2.0 release
1 parent 8290a8e commit bd43b6e

File tree

5 files changed

+73
-81
lines changed

5 files changed

+73
-81
lines changed

CHANGELOG.md

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,47 @@
1-
# 0.2.0-alpha3 (Oct 14, 2020)
2-
3-
### Fixes
4-
- Missing CI checks on non-default features
5-
6-
### Added
7-
- Support for `SET`s and `SET OF`s\*
8-
- Support for extensible `SET`s
9-
- Support for `SIZE` constraints for `SET OF`s
10-
- `TagResolver` to properly resolve Tags of ASN.1 types
11-
- `syn::common::Constraint` which has `const TAG: Tag` and implementation for all generated constraint types
12-
13-
\* For `SET OF` only BASIC-PER encoding is supported currently, see [#20](https://github.com/kellerkindt/asn1rs/issues/20)
14-
15-
### Changes
16-
- The ASN.1 `OPTIONAL` type is now represented as `optional` instead of `option` in `#[asn(..)]`
17-
- The protobuf serializer is now optional and can be enabled with the `protobuf` feature flag
18-
19-
# 0.2.0-alpha2 (Sep 03, 2020)
1+
# Version 0.2.0 (2021-02-03)
202

213
This release includes a lot of refactoring and new features.
224
With these changes, it is now possible to use the following two ASN.1 standards:
235

24-
- 🎉 ```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) ts(102894) cdd(2) version(1)``` (ITS-Container)
25-
- 🎉 ```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) en(302637) cam(2) version(1)``` (CAM-PDU-Descriptions)
6+
- 🎉 ```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) ts(102894) cdd(2) version(1)``` (ITS-Container)
7+
- 🎉 ```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) en(302637) cam(2) version(1)``` (CAM-PDU-Descriptions)
268

9+
The serialization and deserialization process was completely revamped to replace the code generation that uses string concatenation and instead utilize (smaller) proc-macros and types for it.
10+
The previous - now called legacy codegen - is still available, but deprecated and hidden behind the `legacy-uper-codegen` and `legacy-protobuf-codegen` feature.
11+
It will be **removed in 0.3.0**.
12+
13+
Feel free to visit [the tests](tests) to learn about the new usage. You might want to start with the [showcase].
2714

2815
### Fixes
16+
- lots of smaller and niche parsing errors
2917
- Implement the canonical order for tags (ITU-T X.680 | ISO/IEC 8824-1, 8.6)
18+
- Missing CI checks on non-default features
3019

3120
### Added
21+
- support for ASN-extensible `CHOICE` and `ENUMERATED` types
22+
- `Reader`, `Writer` traits to (de)serialize based on the visitor pattern, asn attribute annotation, see [showcase] and [proc_macro_attribute]. This will allow further ASN encodings to be implemented without further code generation (to be clear, this not on the roadmap for now, but PRs are welcome).
3223
- Support for `INTEGER` constants
3324
- Support for extensible `SEQUENCE`s
3425
- Support for extensible `INTEGER`s
3526
- Support for `BIT STRING`, as well as the `SIZE` constraint, constants, and the extensible flag
3627
- Support for `IA5String`, as well as the `SIZE` constraint, and the extensible flag
3728
- Support for `SIZE` constraints for `OCTET STRING`s
3829
- Support for `SIZE` constraints for `UTF8String`s
39-
- Support for `SIZE` constraints for `SEQUENCE OF`s
40-
- ASN.1 Support Overview to README
41-
42-
### Changes
43-
- Parse/Accept ObjectIdentifier in `FROM` directives and module definitions
44-
- The whole module `crate::io::uper` is now **deprecated**
45-
- Reimplemented all low level uPER functions - this time strictly according to specification and using names mentioned there, see ```crate::io::per```
46-
- Better prepare for alternative encoding rules (especially aligned PER, although this is no specific goal)
47-
- Help the compiler in figuring out where const evaluations are possible (see `const_*!` macros)
48-
- Lots of `#[inline]` hinting
30+
- Support for `SIZE` constraints for `SEQUENCE OF`s
31+
- Support for `SET`s and `SET OF`s\*
32+
- Support for extensible `SET`s
33+
- Support for `SIZE` constraints for `SET OF`s
34+
- `TagResolver` to properly resolve Tags of ASN.1 types
35+
- `syn::common::Constraint` which has `const TAG: Tag` and implementation for all generated constraint types
36+
- CI checks for specific feature combinations
4937

5038

51-
# 0.2.0-alpha1 (May 13, 2020)
5239

53-
### Fixes
54-
- lots of smaller and niche parsing errors
55-
56-
### Added
57-
- support for ASN-extensible `CHOICE` and `ENUMERATED` types
58-
- `Reader`, `Writer` traits to (de)serialize based on the visitor pattern, asn attribute annotation, see [showcase] and [proc_macro_attribute]. This will allow further ASN encodings to be implemented without further code generation (to be clear, this not on the roadmap for now, but PRs are welcome).
40+
\* For `SET OF` only BASIC-PER encoding is supported currently, see [#20](https://github.com/kellerkindt/asn1rs/issues/20)
5941

6042
### Changes
61-
- deprecated `UperSerializer` which generates a lot of complex code for (uper-)serialization. Instead general purpose and less complex code that is based on the visitor pattern will be generated. See [showcase] and commits linked to [#11]. This also allows to write ASN serializable structures without writing ASN itself (see [proc_macro_attribute]):
43+
- Added ASN.1 Support Overview to README
44+
- Deprecated `UperSerializer` which generates a lot of complex code for (uper-)serialization. Instead general purpose and less complex code that is based on the visitor pattern will be generated. See [showcase] and commits linked to [#11]. This also allows to write ASN serializable structures without writing ASN itself (see [proc_macro_attribute]):
6245

6346
```rust
6447
#[asn(sequence)]
@@ -87,6 +70,15 @@ fn pizza_test_uper_1() {
8770
}
8871

8972
```
73+
- Parse/Accept ObjectIdentifier in `FROM` directives and module definitions
74+
- The module `crate::io::uper` is now **deprecated**
75+
- Reimplemented all low level uPER functions - this time strictly according to specification and using names mentioned there, see ```crate::io::per```
76+
- Better prepare for alternative encoding rules (especially aligned PER, although this is no specific goal)
77+
- Help the compiler in figuring out where const evaluations are possible (see `const_*!` macros)
78+
- Lots of `#[inline]` hinting
79+
- The ASN.1 `OPTIONAL` type is now represented as `optional` instead of `option` in `#[asn(..)]`
80+
- The protobuf serializer is now optional and can be enabled with the `protobuf` feature flag
81+
- Deprecated `Protobuf` trait which is replaced by `ProtobufReader` and `ProtobufWriter` that use the common `Readable` and `Writable` traits
9082

9183
[showcase]: tests/showcase.rs
9284
[proc_macro_attribute]: tests/basic_proc_macro_attribute.rs

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "asn1rs"
3-
version = "0.2.0-alpha3"
3+
version = "0.2.0"
44
authors = ["Michael Watzko <[email protected]>"]
55
edition = "2018"
66
description = "ASN.1 to Rust, Protobuf and SQL compiler/code generator. Supports ASN.1 UPER"
@@ -44,8 +44,8 @@ futures = { version = "0.3.4", optional = true }
4444
bytes = { version = "0.5.4", optional = true }
4545

4646
# feature asn1rs-*
47-
asn1rs-model = { version = "0.2.0-alpha3", path = "asn1rs-model", optional = true }
48-
asn1rs-macros = { version = "0.2.0-alpha3", path = "asn1rs-macros", optional = true }
47+
asn1rs-model = { version = "0.2.0", path = "asn1rs-model", optional = true }
48+
asn1rs-macros = { version = "0.2.0", path = "asn1rs-macros", optional = true }
4949

5050
[dev-dependencies]
5151
syn = {version = "1.0.28", features = ["full"] }

README.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# asn1rs - ASN.1 Compiler for Rust
22

33
This crate generates Rust Code and optionally compatible Protobuf and SQL schema files from ASN.1 definitions.
4-
Basic support for [serde](https://crates.io/crates/serde) integration is provided.
4+
Integration with [serde](https://crates.io/crates/serde) is supported.
5+
56
The crate can be used as standalone CLI binary or used as library through its API
6-
(for example inside the ```build.rs``` script).
7+
(for example inside your ```build.rs``` script).
78

89

910
[![Build Status](https://github.com/kellerkindt/asn1rs/workflows/Rust/badge.svg)](https://github.com/kellerkindt/asn1rs/actions?query=workflow%3ARust)
@@ -14,12 +15,8 @@ The crate can be used as standalone CLI binary or used as library through its AP
1415

1516

1617

17-
#### Support Table
18+
### Supported Features
1819

19-
**TLDR**
20-
- The legacy UPER Reader/Writer does not support all features (pre v0.2.0)
21-
- Protobuf, sync and async PSQL ignore most constraints
22-
- The new (v0.2.0) UPER Reader/Writer supports all listed features
2320

2421
| Feature | Parses | UPER | Protobuf | PSQL | Async PSQL | UPER Legacy\* |
2522
| --------------------|:--------|:--------|:------------|:------------|:-----------|------------------:|
@@ -67,13 +64,20 @@ The crate can be used as standalone CLI binary or used as library through its AP
6764
- ❌ ub: undefined behavior - whatever seems reasonable to prevent compiler errors and somehow transmit the value
6865
- 🟥 error: fails to compile / translate
6966

70-
\*The legacy UPER Reader/Writer is deprecated and will be removed in or before v0.3.0
67+
\*The legacy UPER Reader/Writer is deprecated and will be removed in version 0.3.0
7168

72-
##### Supported standards
73-
- ```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) ts(102894) cdd(2) version(1)``` (ITS-Container)
74-
- ```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) en(302637) cam(2) version(1)``` (CAM-PDU-Descriptions)
69+
**TLDR**
70+
- The new (v0.2.0) UPER Reader/Writer supports all listed features
71+
- Protobuf, sync&async PSQL ignore most constraints
72+
- The legacy UPER Reader/Writer does not support all features (pre v0.2.0)
7573

76-
#### CLI usage
74+
#### Supported standards
75+
- [ETSI TS 102 894-2 / ITS-Container](https://www.etsi.org/deliver/etsi_ts/102800_102899/10289402/01.02.01_60/ts_10289402v010201p.pdf): \
76+
```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) ts(102894) cdd(2) version(1)```
77+
- [ETSI EN 302 637-2 / ITS-CAM](https://www.etsi.org/deliver/etsi_en/302600_302699/30263702/01.03.01_30/en_30263702v010301v.pdf): \
78+
```itu-t(0) identified-organization(4) etsi(0) itsDomain(5) wg1(1) en(302637) cam(2) version(1)```
79+
80+
### CLI usage
7781

7882
It is always helpful to check ```asn1rs --help``` in advance.
7983
The basic usage can be seen blow:
@@ -90,11 +94,11 @@ asn1rs -t proto directory/for/protobuf/files some.asn1 messages.asn1
9094
asn1rs -t sql directory/for/sql/schema/files some.asn1 messages.asn1
9195
```
9296

93-
#### API usage
97+
### Example: build.rs
9498

95-
The following example generates Rust, Protobuf and SQL files for all ```.asn1```-files in the ```asn/``` directory of the project.
99+
The following example generates Rust, Protobuf and SQL files for all ```.asn1```-files in the ```asn/``` directory of a workspace.
96100
While the generated Rust code is written to the ```src/``` directory, the Protobuf files are written to ```proto/``` and the SQL files are written to ```sql/ ```.
97-
Additionally, in this example each generated Rust-Type also receives ```Serialize``` and ```Deserialize``` derive directives (```#[derive(Serialize, Deserialize)]```) for automatic [serde](https://crates.io/crates/serde) integration.
101+
Additionally, in this example each generated Rust-Type also receives ```Serialize``` and ```Deserialize``` derive directives (```#[derive(Serialize, Deserialize)]```) for [serde](https://crates.io/crates/serde) integration.
98102

99103
Sample ```build.rs``` file:
100104

@@ -124,8 +128,8 @@ pub fn main() {
124128
.filter(|entry| entry.ends_with(".asn1"))
125129
})
126130
.for_each(|path| {
131+
println!("cargo:rerun-if-changed={}", path);
127132
if let Err(e) = converter.load_file(&path) {
128-
println!("cargo:rerun-if-changed={}", path);
129133
panic!("Loading of .asn1 file failed {}: {:?}", path, e);
130134
}
131135
});
@@ -157,9 +161,9 @@ pub fn main() {
157161

158162
```
159163

160-
#### Inlining ASN.1 with procedural macros
164+
### Example: Inlining ASN.1 with procedural macros
161165

162-
Minimal example by inlining the ASN.1 definition. For more examples, see ```tests/```.
166+
Minimal example by inlining the ASN.1 definition. For more examples see [tests/](tests).
163167
```rust
164168
use asn1rs::prelude::*;
165169

@@ -191,7 +195,7 @@ fn test_write_read() {
191195
#[test]
192196
fn test_constraint_eq() {
193197
// these types should normally not be accessed, but in this exampled they show
194-
// the way the ASN.1 constraints are encoded in to the struct type constraints.
198+
// the way the ASN.1 constraints are encoded with the Rust type system.
195199
use asn1rs::syn::numbers::Constraint;
196200
assert_eq!(
197201
___asn1rs_RangedMaxField0Constraint::MIN,
@@ -205,7 +209,7 @@ fn test_constraint_eq() {
205209
```
206210

207211

208-
#### Example ASN.1-Definition to Rust, Protobuf and SQL
212+
### Example: ASN.1-Definition converted to Rust, Protobuf and SQL
209213

210214
Minimal example showcasing what is being generated from an ASN.1 definition:
211215

@@ -231,25 +235,21 @@ pub struct Header {
231235
#[asn(integer(0..1209600000))] pub timestamp: u32,
232236
}
233237

234-
// OPTIONAL: Insert and query functions for async PostgreSQL
238+
// only with the feature "async-psql": Insert and query functions for async PostgreSQL
235239
impl Header {
236240
pub async fn apsql_retrieve_many(context: &apsql::Context<'_>, ids: &[i32]) -> Result<Vec<Self>, apsql::Error> { /*..*/ }
237241
pub async fn apsql_retrieve(context: &apsql::Context<'_>, id: i32) -> Result<Self, apsql::Error> { /*..*/ }
238242
pub async fn apsql_load(context: &apsql::Context<'_>, row: &apsql::Row) -> Result<Self, apsql::Error> { /*..*/ }
239243
pub async fn apsql_insert(&self, context: &apsql::Context<'_>) -> Result<i32, apsql::PsqlError> { /*..*/ }
240244
}
241245

242-
// OPTIONAL: Serialize and deserialize functions for protobuf
243-
impl ProtobufEq for Header { /*..*/ }
244-
impl Protobuf for Header { /*..*/ }
245-
246-
// OPTIONAL: Insert and query functions for non-async PostgreSQL
246+
// only with the feature "psql": Insert and query functions for non-async PostgreSQL
247247
impl PsqlRepresentable for Header { /*..*/ }
248248
impl PsqlInsertable for Header { /*..*/ }
249249
impl PsqlQueryable for Header { /*..*/ }
250250
```
251251

252-
OPTIONAL: The generated protobuf file:
252+
The generated protobuf file (optional):
253253

254254
```proto
255255
syntax = 'proto3';
@@ -260,7 +260,7 @@ message Header {
260260
}
261261
```
262262

263-
OPTIONAL: The generated (p)sql file:
263+
The generated SQL file (optional):
264264

265265
```sql
266266
DROP TABLE IF EXISTS Header CASCADE;
@@ -271,11 +271,11 @@ CREATE TABLE Header (
271271
);
272272
```
273273

274-
#### Example usage of async postgres
274+
#### Example: Usage of async postgres
275275
NOTE: This requires the `async-psql` feature.
276276

277-
Using async postgres allows the message - or the batched messages - to take advantage of [`pipelining`] automatically.
278-
This can provide a speedup (personal experience: at around 26%) compared to the synchronous/blocking postgres implementation.
277+
Using async postgres allows the message - or the batched messages - to take advantage of [`pipelining`].
278+
This can provide a significant speedup for deep message types (personal experience this is around 26%) compared to the synchronous/blocking postgres implementation.
279279

280280
```rust
281281
use asn1rs::io::async_psql::*;
@@ -342,7 +342,7 @@ async fn main() {
342342
}
343343
```
344344

345-
#### Raw uPER usage
345+
#### Example: Raw uPER usage
346346
The module ```asn1rs::io``` exposes (de-)serializers and helpers for direct usage without ASN.1 definition:
347347
```rust
348348
use asn1rs::prelude::*;
@@ -355,7 +355,7 @@ buffer.write_utf8_string("My UTF8 Text").unwrap();
355355
send_to_another_host(buffer.into::<Vec<u8>>()):
356356
```
357357

358-
#### Raw Protobuf usage
358+
#### Example: Raw Protobuf usage
359359
The module ```asn1rs::io::protobuf``` exposes (de-)serializers for protobuf usage:
360360
```rust
361361
use asn1rs::io::protobuf::*;
@@ -372,10 +372,10 @@ send_to_another_host(buffer):
372372
Things to do at some point in time (PRs are welcome)
373373

374374
- generate a proper rust module hierarchy from the modules' object-identifier
375-
- remove legacy rust+uper code generator (probably in 0.3)
375+
- remove legacy rust+uper code generator (v0.3.0)
376376
- support ```#![no_std]```
377-
- refactor / clean-up (rust) code-generators
378-
- support more encoding formats of ASN.1
377+
- refactor / clean-up (rust) code-generators (most will be removed in v0.3.0)
378+
- support more encoding formats of ASN.1 (help is welcome!)
379379

380380

381381
#### License

asn1rs-macros/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "asn1rs-macros"
3-
version = "0.2.0-alpha3"
3+
version = "0.2.0"
44
authors = ["Michael Watzko <[email protected]>"]
55
edition = "2018"
66
description = "Macros for asn1rs"
@@ -20,6 +20,6 @@ debug-proc-macro = []
2020

2121

2222
[dependencies]
23-
asn1rs-model = { version = "0.2.0-alpha3", path = "../asn1rs-model" }
23+
asn1rs-model = { version = "0.2.0", path = "../asn1rs-model" }
2424
syn = {version = "1.0.17", features = ["full"] }
2525
quote = "1.0.3"

asn1rs-model/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "asn1rs-model"
3-
version = "0.2.0-alpha3"
3+
version = "0.2.0"
44
authors = ["Michael Watzko <[email protected]>"]
55
edition = "2018"
66
description = "Rust, Protobuf and SQL model definitions for asn1rs"

0 commit comments

Comments
 (0)