@@ -93,7 +93,7 @@ use bullet_stream as _;
93
93
/// When a `CacheDiff::diff` is empty, the layer is kept and the old data is returned. Otherwise,
94
94
/// the layer is deleted and the changes are returned.
95
95
///
96
- /// **TUTORIAL:** In the [`diff_migrate`] module docs
96
+ /// **TUTORIAL:** In the [`crate::layer:: diff_migrate`] module docs
97
97
#[ derive( Debug , Clone , Eq , PartialEq ) ]
98
98
pub struct DiffMigrateLayer {
99
99
/// Whether the layer is intended for build.
@@ -138,7 +138,7 @@ impl DiffMigrateLayer {
138
138
/// When given a prior [`LayerRename::from`] that exists, but the [`LayerRename::to`]
139
139
/// does not, then the contents of the prior layer will be copied before being deleted.
140
140
///
141
- /// After that this function callse [`cached_layer`] on the new layer.
141
+ /// After that this function calls [`crate::layer::diff_migrate::DiffMigrateLayer:: cached_layer`] on the new layer.
142
142
///
143
143
/// # Panics
144
144
///
@@ -320,10 +320,11 @@ mod tests {
320
320
use libcnb:: data:: layer_name;
321
321
use libcnb:: generic:: { GenericMetadata , GenericPlatform } ;
322
322
use libcnb:: layer:: { EmptyLayerCause , InvalidMetadataAction , LayerState , RestoredLayerAction } ;
323
- use magic_migrate:: { migrate_toml_chain , try_migrate_deserializer_chain , Migrate , TryMigrate } ;
323
+ use magic_migrate:: TryMigrate ;
324
324
use std:: convert:: Infallible ;
325
325
/// Struct for asserting the behavior of `CacheBuddy`
326
- #[ derive( Debug , serde:: Serialize , serde:: Deserialize , Clone ) ]
326
+ #[ derive( Debug , serde:: Serialize , serde:: Deserialize , Clone , TryMigrate ) ]
327
+ #[ try_migrate( from = None ) ]
327
328
#[ serde( deny_unknown_fields) ]
328
329
struct TestMetadata {
329
330
value : String ,
@@ -337,7 +338,6 @@ mod tests {
337
338
}
338
339
}
339
340
}
340
- migrate_toml_chain ! { TestMetadata }
341
341
342
342
struct FakeBuildpack ;
343
343
impl libcnb:: Buildpack for FakeBuildpack {
@@ -555,13 +555,15 @@ mod tests {
555
555
}
556
556
557
557
/// Struct for asserting the behavior of `invalid_metadata_action`
558
- #[ derive( serde:: Deserialize , serde:: Serialize , Debug , Clone ) ]
558
+ #[ derive( serde:: Deserialize , serde:: Serialize , Debug , Clone , TryMigrate ) ]
559
+ #[ try_migrate( from = None ) ]
559
560
#[ serde( deny_unknown_fields) ]
560
561
struct PersonV1 {
561
562
name : String ,
562
563
}
563
564
/// Struct for asserting the behavior of `invalid_metadata_action`
564
- #[ derive( serde:: Deserialize , serde:: Serialize , Debug , Clone ) ]
565
+ #[ derive( serde:: Deserialize , serde:: Serialize , Debug , Clone , TryMigrate ) ]
566
+ #[ try_migrate( from = PersonV1 ) ]
565
567
#[ serde( deny_unknown_fields) ]
566
568
struct PersonV2 {
567
569
name : String ,
@@ -583,25 +585,11 @@ mod tests {
583
585
}
584
586
}
585
587
}
586
- #[ derive( Debug , Eq , PartialEq ) ]
588
+ #[ derive( Debug , Eq , PartialEq , thiserror:: Error ) ]
589
+ #[ error( "Not Richard" ) ]
587
590
struct NotRichard {
588
591
name : String ,
589
592
}
590
- impl From < NotRichard > for PersonMigrationError {
591
- fn from ( value : NotRichard ) -> Self {
592
- PersonMigrationError :: NotRichard ( value)
593
- }
594
- }
595
- #[ derive( Debug , Eq , PartialEq , thiserror:: Error ) ]
596
- enum PersonMigrationError {
597
- #[ error( "Not Richard" ) ]
598
- NotRichard ( NotRichard ) ,
599
- }
600
- try_migrate_deserializer_chain ! (
601
- deserializer: toml:: Deserializer :: new,
602
- error: PersonMigrationError ,
603
- chain: [ PersonV1 , PersonV2 ] ,
604
- ) ;
605
593
606
594
#[ test]
607
595
fn test_invalid_metadata_action ( ) {
0 commit comments