Skip to content

Commit 73fe2d5

Browse files
committed
Remove union support and update changelog.
Signed-off-by: Andrei Sandu <[email protected]>
1 parent af4d79f commit 73fe2d5

File tree

7 files changed

+12
-319
lines changed

7 files changed

+12
-319
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v0.1.2
2+
3+
- Removed union serialization support.
4+
15
# v0.1.1
26

37
- Removed "versionize" dependency.

src/descriptors/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33

44
pub mod enum_desc;
55
pub mod struct_desc;
6-
pub mod union_desc;

src/descriptors/union_desc.rs

Lines changed: 0 additions & 168 deletions
This file was deleted.

src/fields/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33

44
pub mod enum_variant;
55
pub mod struct_field;
6-
pub mod union_field;

src/fields/union_field.rs

Lines changed: 0 additions & 137 deletions
This file was deleted.

src/helpers.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ pub(crate) fn parse_field_attributes(attributes: &[syn::Attribute]) -> HashMap<S
7272
attrs
7373
}
7474

75-
pub fn is_array(ty: &syn::Type) -> bool {
76-
match ty {
77-
syn::Type::Array(_) => true,
78-
_ => false,
79-
}
80-
}
81-
8275
// Compute current struct version by finding the latest field change version.
8376
pub(crate) fn compute_version<T>(fields: &[T]) -> u16
8477
where

src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![deny(missing_docs)]
44

55
//! Exports the Versionize derive proc macro that generates the Versionize implementation
6-
//! for structs, enums and unions by using structure annotations.
6+
//! for structs, and enums by using annotations.
77
88
extern crate proc_macro;
99
extern crate proc_macro2;
@@ -16,9 +16,7 @@ mod fields;
1616
mod helpers;
1717

1818
use common::Descriptor;
19-
use descriptors::{
20-
enum_desc::EnumDescriptor, struct_desc::StructDescriptor, union_desc::UnionDescriptor,
21-
};
19+
use descriptors::{enum_desc::EnumDescriptor, struct_desc::StructDescriptor};
2220
use proc_macro::TokenStream;
2321
use quote::quote;
2422
use syn::{parse_macro_input, DeriveInput};
@@ -44,7 +42,12 @@ pub fn impl_versionize(input: TokenStream) -> proc_macro::TokenStream {
4442
Box::new(StructDescriptor::new(&data_struct, ident.clone()))
4543
}
4644
syn::Data::Enum(data_enum) => Box::new(EnumDescriptor::new(&data_enum, ident.clone())),
47-
syn::Data::Union(data_union) => Box::new(UnionDescriptor::new(&data_union, ident.clone())),
45+
syn::Data::Union(_) => {
46+
return (quote! {
47+
compile_error!("Union serialization is not supported.");
48+
})
49+
.into()
50+
}
4851
};
4952

5053
let version = descriptor.version();

0 commit comments

Comments
 (0)