Skip to content

Commit

Permalink
Allow any serialized TOML that can be infallibly migrated to be falli…
Browse files Browse the repository at this point in the history
…bly migrated automatically
  • Loading branch information
schneems committed Jan 9, 2024
1 parent 6856d33 commit 5f3b0f5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions commons/src/magic_migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ where
}
}

/// Implement `TryMigrateToml` for all structs that infailably
/// can `MigrateToml`.
impl<T> TryMigrateToml for T
where
T: MigrateToml,
{
type TryFrom = <Self as MigrateToml>::From;

type Error = std::convert::Infallible;
}

#[cfg(test)]
mod tests {
use std::convert::Infallible;
Expand Down

0 comments on commit 5f3b0f5

Please sign in to comment.