diff --git a/CHANGELOG.md b/CHANGELOG.md index 94c671db0..8694907e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.0.0-rc.2 - Pending + +### Breaking Changes + +* Updated Strum to version 0.26 https://github.com/SeaQL/sea-orm/pull/2088 + ## 1.0.0-rc.1 - 2024-02-06 ### Breaking Changes diff --git a/Cargo.toml b/Cargo.toml index 4b972eec1..71c89136b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ bigdecimal = { version = "0.3", default-features = false, optional = true } sea-orm-macros = { version = "1.0.0-rc.1", path = "sea-orm-macros", default-features = false, features = ["strum"] } sea-query = { version = "0.31.0-rc.3", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] } sea-query-binder = { version = "0.6.0-rc.1", default-features = false, optional = true } -strum = { version = "0.25", default-features = false } +strum = { version = "0.26", default-features = false } serde = { version = "1.0", default-features = false } serde_json = { version = "1.0", default-features = false, optional = true } sqlx = { version = "0.7", default-features = false, optional = true } diff --git a/build-tools/update-strum-macros.sh b/build-tools/update-strum-macros.sh new file mode 100644 index 000000000..b5fa10c80 --- /dev/null +++ b/build-tools/update-strum-macros.sh @@ -0,0 +1,8 @@ +rm -rf sea-orm-macros/src/strum/helpers +rm -rf sea-orm-macros/src/strum/enum_iter.rs + +cp -r ../strum/strum_macros/src/helpers sea-orm-macros/src/strum/helpers +cp -r ../strum/strum_macros/src/macros/enum_iter.rs sea-orm-macros/src/strum/enum_iter.rs + +sed -i 's/crate::helpers::{*/super::helpers::{/' sea-orm-macros/src/strum/enum_iter.rs +sed -i 's/parse_quote!(::strum)*/parse_quote!(sea_orm::strum)/' sea-orm-macros/src/strum/helpers/type_props.rs \ No newline at end of file diff --git a/sea-orm-macros/src/strum/enum_iter.rs b/sea-orm-macros/src/strum/enum_iter.rs index e4f153ad5..ef84b4592 100644 --- a/sea-orm-macros/src/strum/enum_iter.rs +++ b/sea-orm-macros/src/strum/enum_iter.rs @@ -74,14 +74,14 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { #[allow( missing_copy_implementations, )] - #vis struct #iter_name #ty_generics { + #vis struct #iter_name #impl_generics { idx: usize, back_idx: usize, marker: ::core::marker::PhantomData #phantom_data, } - impl #impl_generics core::fmt::Debug for #iter_name #ty_generics #where_clause { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + impl #impl_generics ::core::fmt::Debug for #iter_name #ty_generics #where_clause { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { // We don't know if the variants implement debug themselves so the only thing we // can really show is how many elements are left. f.debug_struct(#iter_name_debug_struct) @@ -91,7 +91,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { } impl #impl_generics #iter_name #ty_generics #where_clause { - fn get(&self, idx: usize) -> Option<#name #ty_generics> { + fn get(&self, idx: usize) -> ::core::option::Option<#name #ty_generics> { match idx { #(#arms),* } @@ -112,16 +112,16 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { impl #impl_generics Iterator for #iter_name #ty_generics #where_clause { type Item = #name #ty_generics; - fn next(&mut self) -> Option<::Item> { + fn next(&mut self) -> ::core::option::Option<::Item> { self.nth(0) } - fn size_hint(&self) -> (usize, Option) { + fn size_hint(&self) -> (usize, ::core::option::Option) { let t = if self.idx + self.back_idx >= #variant_count { 0 } else { #variant_count - self.idx - self.back_idx }; (t, Some(t)) } - fn nth(&mut self, n: usize) -> Option<::Item> { + fn nth(&mut self, n: usize) -> ::core::option::Option<::Item> { let idx = self.idx + n + 1; if idx + self.back_idx > #variant_count { // We went past the end of the iterator. Freeze idx at #variant_count @@ -143,7 +143,7 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { } impl #impl_generics DoubleEndedIterator for #iter_name #ty_generics #where_clause { - fn next_back(&mut self) -> Option<::Item> { + fn next_back(&mut self) -> ::core::option::Option<::Item> { let back_idx = self.back_idx + 1; if self.idx + back_idx > #variant_count { @@ -159,6 +159,8 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result { } } + impl #impl_generics ::core::iter::FusedIterator for #iter_name #ty_generics #where_clause { } + impl #impl_generics Clone for #iter_name #ty_generics #where_clause { fn clone(&self) -> #iter_name #ty_generics { #iter_name {