pub struct MigrateError { /* private fields */ }
Expand description
A generic wrapper when TryFrom::Error is raised on Migration
Acts somewhat like anyhow::Error, to store TryFrom::Error
-s
as your structs try to migrate. Works with anything that implements
std::error::Error
.
use magic_migrate::{MigrateError, TryMigrate};
impl magic_migrate::TryMigrate for PersonV2 {
type TryFrom = PersonV1;
type Error = MigrateError;
fn deserializer<'de>(input: &str) -> impl serde::de::Deserializer<'de> {
toml::Deserializer::new(input)
}
}
let result: Result<PersonV2, MigrateError> = PersonV2::try_from_str_migrations("name = 'Richard'").unwrap();
Trait Implementations§
Source§impl AsRef<dyn Error> for MagicError
impl AsRef<dyn Error> for MagicError
Source§impl Debug for MagicError
impl Debug for MagicError
Source§impl Deref for MagicError
impl Deref for MagicError
Source§impl Display for MagicError
impl Display for MagicError
Source§impl<E> From<E> for MagicError
impl<E> From<E> for MagicError
Source§impl From<MagicError> for Box<dyn Error + 'static>
impl From<MagicError> for Box<dyn Error + 'static>
Source§fn from(value: MagicError) -> Self
fn from(value: MagicError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MagicError
impl !RefUnwindSafe for MagicError
impl Send for MagicError
impl Sync for MagicError
impl Unpin for MagicError
impl !UnwindSafe for MagicError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more