base_transform: Reset unused vfuncs on consecutive configure calls

If a user ends up changing the configured mode later on previously
registered vfuncs are not reset meaning the object is effectively stuck
in mode `Both`.
This commit is contained in:
Marijn Suijten 2020-09-01 09:50:12 +02:00
parent 160728965b
commit beaa22fabb

View file

@ -874,10 +874,12 @@ pub unsafe trait BaseTransformClassSubclassExt: Sized + 'static {
match mode {
BaseTransformMode::AlwaysInPlace => {
klass.transform = None;
klass.transform_ip = Some(base_transform_transform_ip::<T>);
}
BaseTransformMode::NeverInPlace => {
klass.transform = Some(base_transform_transform::<T>);
klass.transform_ip = None;
}
BaseTransformMode::Both => {
klass.transform = Some(base_transform_transform::<T>);