<commit_before>macro_rules! not_none {
    ($bytes:expr) => {
        match $bytes {
            Some(bytes) => bytes,
            None => return Err(Box::new($crate::types::impls::option::UnexpectedNullError {
                msg: "Unexpected null for non-null column".to_string(),
            })),
        }
    }
}

macro_rules! expression_impls {
    ($($Source:ident -> $Target:ty),+,) => {
        $(
            impl<'a> $crate::expression::AsExpression<types::$Source> for $Target {
                type Expression = $crate::expression::bound::Bound<types::$Source, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a, 'expr> $crate::expression::AsExpression<types::$Source> for &'expr $Target {
                type Expression = $crate::expression::bound::Bound<types::$Source, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a> $crate::expression::AsExpression<$crate::types::Nullable<types::$Source>> for $Target {
                type Expression = $crate::expression::bound::Bound<$crate::types::Nullable<types::$Source>, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a, 'expr> $crate::expression::AsExpression<$crate::types::Nullable<types::$Source>> for &'expr $Target {
                type Expression = $crate::expression::bound::Bound<$crate::types::Nullable<types::$Source>, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a, DB> $crate::types::ToSql<$crate::types::Nullable<types::$Source>, DB> for $Target where
                DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
                $Target: $crate::types::ToSql<types::$Source, DB>,
            {
                fn to_sql<W: ::std::io::Write>(&self, out: &mut W) -> Result<$crate::types::IsNull, Box<::std::error::Error+Send+Sync>> {
                    $crate::types::ToSql::<types::$Source, DB>::to_sql(self, out)
                }
            }
        )+
    }
}

macro_rules! queryable_impls {
    ($($Source:ident -> $Target:ty),+,) => {$(
        impl<DB> $crate::types::FromSqlRow<types::$Source, DB> for $Target where
            DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
            $Target: $crate::types::FromSql<types::$Source, DB>,
        {
            fn build_from_row<R: $crate::row::Row<DB>>(row: &mut R) -> Result<Self, Box<::std::error::Error+Send+Sync>> {
                $crate::types::FromSql::<types::$Source, DB>::from_sql(row.take())
            }
        }

        #[cfg(not(feature = "unstable"))]
        impl<DB> $crate::types::FromSqlRow<$crate::types::Nullable<types::$Source>, DB> for Option<$Target> where
            DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
            Option<$Target>: $crate::types::FromSql<$crate::types::Nullable<types::$Source>, DB>,
        {
            fn build_from_row<R: $crate::row::Row<DB>>(row: &mut R) -> Result<Self, Box<::std::error::Error+Send+Sync>> {
                $crate::types::FromSql::<$crate::types::Nullable<types::$Source>, DB>::from_sql(row.take())
            }
        }

        impl<DB> $crate::query_source::Queryable<types::$Source, DB> for $Target where
            DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
            $Target: $crate::types::FromSqlRow<types::$Source, DB>,
        {
            type Row = Self;

            fn build(row: Self::Row) -> Self {
                row
            }
        }
    )+}
}

macro_rules! primitive_impls {
    ($Source:ident -> ($Target:ty, pg: ($oid:expr, $array_oid:expr), sqlite: ($tpe:ident))) => {<commit_msg>Make macros public to allow easily implementing traits outside of diesel<commit_after>macro_rules! not_none {
    ($bytes:expr) => {
        match $bytes {
            Some(bytes) => bytes,
            None => return Err(Box::new($crate::types::impls::option::UnexpectedNullError {
                msg: "Unexpected null for non-null column".to_string(),
            })),
        }
    }
}

#[doc(hidden)]
#[macro_export]
macro_rules! expression_impls {
    ($($Source:ident -> $Target:ty),+,) => {
        $(
            impl<'a> $crate::expression::AsExpression<types::$Source> for $Target {
                type Expression = $crate::expression::bound::Bound<types::$Source, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a, 'expr> $crate::expression::AsExpression<types::$Source> for &'expr $Target {
                type Expression = $crate::expression::bound::Bound<types::$Source, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a> $crate::expression::AsExpression<$crate::types::Nullable<types::$Source>> for $Target {
                type Expression = $crate::expression::bound::Bound<$crate::types::Nullable<types::$Source>, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a, 'expr> $crate::expression::AsExpression<$crate::types::Nullable<types::$Source>> for &'expr $Target {
                type Expression = $crate::expression::bound::Bound<$crate::types::Nullable<types::$Source>, Self>;

                fn as_expression(self) -> Self::Expression {
                    $crate::expression::bound::Bound::new(self)
                }
            }

            impl<'a, DB> $crate::types::ToSql<$crate::types::Nullable<types::$Source>, DB> for $Target where
                DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
                $Target: $crate::types::ToSql<types::$Source, DB>,
            {
                fn to_sql<W: ::std::io::Write>(&self, out: &mut W) -> Result<$crate::types::IsNull, Box<::std::error::Error+Send+Sync>> {
                    $crate::types::ToSql::<types::$Source, DB>::to_sql(self, out)
                }
            }
        )+
    }
}

#[doc(hidden)]
#[macro_export]
macro_rules! queryable_impls {
    ($($Source:ident -> $Target:ty),+,) => {$(
        impl<DB> $crate::types::FromSqlRow<types::$Source, DB> for $Target where
            DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
            $Target: $crate::types::FromSql<types::$Source, DB>,
        {
            fn build_from_row<R: $crate::row::Row<DB>>(row: &mut R) -> Result<Self, Box<::std::error::Error+Send+Sync>> {
                $crate::types::FromSql::<types::$Source, DB>::from_sql(row.take())
            }
        }

        #[cfg(not(feature = "unstable"))]
        impl<DB> $crate::types::FromSqlRow<$crate::types::Nullable<types::$Source>, DB> for Option<$Target> where
            DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
            Option<$Target>: $crate::types::FromSql<$crate::types::Nullable<types::$Source>, DB>,
        {
            fn build_from_row<R: $crate::row::Row<DB>>(row: &mut R) -> Result<Self, Box<::std::error::Error+Send+Sync>> {
                $crate::types::FromSql::<$crate::types::Nullable<types::$Source>, DB>::from_sql(row.take())
            }
        }

        impl<DB> $crate::query_source::Queryable<types::$Source, DB> for $Target where
            DB: $crate::backend::Backend + $crate::types::HasSqlType<types::$Source>,
            $Target: $crate::types::FromSqlRow<types::$Source, DB>,
        {
            type Row = Self;

            fn build(row: Self::Row) -> Self {
                row
            }
        }
    )+}
}

#[doc(hidden)]
#[macro_export]
macro_rules! primitive_impls {
    ($Source:ident -> ($Target:ty, pg: ($oid:expr, $array_oid:expr), sqlite: ($tpe:ident))) => {
{'fraction_non_alphanumeric': 0.18744007670182167, 'fraction_numerical': 0.0, 'mean_word_length': 2.55863539445629, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2335597', 'n_tokens_mistral': 2458, 'n_tokens_neox': 2526, 'n_words': 362}