pub use partial_derive2_derive::*;
pub trait HasPartial {
type Partial;
fn merge_partial(self, partial: Self::Partial) -> Self;
}
pub trait MaybeNone {
fn is_none(&self) -> bool;
}
pub trait PartialDiff<P, D: Diff + Into<P>> {
fn partial_diff(&self, partial: P) -> D;
fn minimize_partial(&self, partial: P) -> P {
self.partial_diff(partial).into()
}
}
#[derive(Debug)]
pub struct FieldDiff {
pub field: &'static str,
pub from: String,
pub to: String,
}
pub trait Diff {
fn iter_field_diffs(&self) -> impl Iterator<Item = FieldDiff>;
}
#[macro_export]
macro_rules! make_option {
(Option<$ty:ty>) => {
Option<$ty>
};
($ty:ty) => {
Option<$ty>
}
}
#[macro_export]
macro_rules! value_as_option {
(Option<$ty:ty>, $expr:expr) => {
$expr
};
($ty:ty, $expr:expr) => {
Some($expr)
};
}
#[macro_export]
macro_rules! value_maybe_as_option {
(Option<$ty:ty>, $_:expr, $expr:expr) => {
$expr
};
($ty:ty, $expr:expr, $_:expr) => {
$expr
};
}
#[macro_export]
macro_rules! value_maybe_as_vec {
(Vec<$ty:ty>, $_:expr, $expr:expr) => {
$expr
};
($ty:ty, $expr:expr, $_:expr) => {
$expr
};
}