Created
May 22, 2017 22:24
-
-
Save anonymous/58333d19f924d19bac6449b7d75d965a to your computer and use it in GitHub Desktop.
Shared via Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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