diff options
| author | acdenisSK <[email protected]> | 2017-10-03 17:09:32 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-10-03 17:09:32 +0200 |
| commit | b9620a6ab37ffe2eb04a6febca2432eb86d0662f (patch) | |
| tree | 492ea098ec6f8880dc869bd8212f3b4c8f27788f /src/utils | |
| parent | Revert "Use the de-generification trick." (diff) | |
| download | serenity-b9620a6ab37ffe2eb04a6febca2432eb86d0662f.tar.xz serenity-b9620a6ab37ffe2eb04a6febca2432eb86d0662f.zip | |
Force `I` to be not implemented outside serenity
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/message_builder.rs | 18 |
1 files changed, 15 insertions, 3 deletions
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<ContentModifier> 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<T: fmt::Display> 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<T: fmt::Display> I for T { } } } - + impl I for ContentModifier { fn into(self) -> Content { self.to_content() } } |