aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-10-03 17:09:32 +0200
committerZeyla Hellyer <[email protected]>2017-10-09 15:47:48 -0700
commit7cf1e523f0c0bee1b7ec11ff6e6565c68f9d173e (patch)
tree51e66945487e4556ebdb57d7c029d1b4f473c1e2 /src/utils
parentRevert "Use the de-generification trick." (diff)
downloadserenity-7cf1e523f0c0bee1b7ec11ff6e6565c68f9d173e.tar.xz
serenity-7cf1e523f0c0bee1b7ec11ff6e6565c68f9d173e.zip
Force `I` to be not implemented outside serenity
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/message_builder.rs18
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() }
}