From b9620a6ab37ffe2eb04a6febca2432eb86d0662f Mon Sep 17 00:00:00 2001 From: acdenisSK Date: Tue, 3 Oct 2017 17:09:32 +0200 Subject: Force `I` to be not implemented outside serenity --- src/utils/message_builder.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/utils') diff --git a/src/utils/message_builder.rs b/src/utils/message_builder.rs index f58c0b3..284ba1e 100644 --- a/src/utils/message_builder.rs +++ b/src/utils/message_builder.rs @@ -909,10 +909,22 @@ impl From for Content { fn from(cm: ContentModifier) -> Content { cm.to_content() } } +mod private { + use super::{Content, ContentModifier}; + use std::fmt; + + pub trait A {} + + impl A for ContentModifier {} + impl A for Content {} + impl A for T {} +} + + /// This trait only exists as way to bypass the shouting of the compiler. Specifically "conflicting /// implementations in core" and alike. -/// However is not meant to be used outside, nor implemented. -pub trait I { +/// However is not meant to be used outside. +pub trait I: self::private::A { fn into(self) -> Content; } @@ -928,7 +940,7 @@ impl I for T { } } } - + impl I for ContentModifier { fn into(self) -> Content { self.to_content() } } -- cgit v1.2.3