From e6db7d71ca7cc7c1cf0c48b9ef4b2f9ae3f6c92c Mon Sep 17 00:00:00 2001 From: Georg Semmler Date: Mon, 22 Jan 2024 14:00:10 +0100 Subject: [PATCH] Fix config flags --- diesel_derives/src/lib.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/diesel_derives/src/lib.rs b/diesel_derives/src/lib.rs index 083cd72cd062..1f108ad07be3 100644 --- a/diesel_derives/src/lib.rs +++ b/diesel_derives/src/lib.rs @@ -1634,6 +1634,8 @@ pub fn table_proc(input: TokenStream) -> TokenStream { /// in your enum, and the backend generated by this derive called MultiBackend. /// For example to support `diesel::sql_types::TimestamptzSqlite` with the `time` crate: /// ``` +/// # #[cfg(all(feature = "sqlite", feature = "time"))] +/// # fn main() { /// use diesel::backend::Backend; /// use diesel::deserialize::{self, FromSql}; /// use diesel::serialize::{self, IsNull, ToSql}; @@ -1641,31 +1643,31 @@ pub fn table_proc(input: TokenStream) -> TokenStream { /// /// #[derive(diesel::MultiConnection)] /// pub enum AnyConnection { -/// # #[cfg(feature = "sqlite")] /// Sqlite(diesel::SqliteConnection), /// } /// -/// # #[cfg(all("sqlite", "time"))] /// impl HasSqlType for MultiBackend { /// fn metadata(lookup: &mut Self::MetadataLookup) -> Self::TypeMetadata { /// MultiBackend::lookup_sql_type::(lookup) /// } /// } /// -/// # #[cfg(all("sqlite", "time"))] /// impl FromSql for time::OffsetDateTime { /// fn from_sql(bytes: ::RawValue<'_>) -> deserialize::Result { /// bytes.from_sql::() /// } /// } /// -/// # #[cfg(all("sqlite", "time"))] /// impl ToSql for time::OffsetDateTime { /// fn to_sql<'b>(&'b self, out: &mut serialize::Output<'b, '_, MultiBackend>) -> serialize::Result { /// out.set_value((diesel::sql_types::TimestamptzSqlite, self)); /// Ok(IsNull::No) /// } /// } +/// # } +/// +/// # #[cfg(not(all(feature = "sqlite", feature = "time")))] +/// # fn main() {} /// ``` #[proc_macro_derive(MultiConnection)] pub fn derive_multiconnection(input: TokenStream) -> TokenStream {