Skip to content

Instantly share code, notes, and snippets.

Created May 22, 2017 22:24
Show Gist options
  • Save anonymous/58333d19f924d19bac6449b7d75d965a to your computer and use it in GitHub Desktop.
Save anonymous/58333d19f924d19bac6449b7d75d965a to your computer and use it in GitHub Desktop.
Shared via Rust Playground
pub struct Nullable<T: NotNull>(T);
pub trait NotNull {
}
pub trait IntoNullable {
type Nullable;
}
impl<T: NotNull> IntoNullable for T {
type Nullable = Nullable<T>;
}
impl<T: NotNull> IntoNullable for Nullable<T> {
type Nullable = Nullable<T>;
}
pub trait Expression {
type SqlType;
}
pub trait Column: Expression {}
#[derive(Debug, Copy, Clone)]
pub enum ColumnInsertValue<Col, Expr> where
Col: Column,
Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
{
Expression(Col, Expr),
Default(Col),
}
fn main() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment