Skip to content

Commit

Permalink
Force I to be not implemented outside serenity
Browse files Browse the repository at this point in the history
  • Loading branch information
arqunis authored and Zeyla Hellyer committed Oct 9, 2017
1 parent 06dc693 commit 7cf1e52
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/utils/message_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -928,7 +940,7 @@ impl<T: fmt::Display> I for T {
}
}
}

impl I for ContentModifier {
fn into(self) -> Content { self.to_content() }
}
Expand Down

0 comments on commit 7cf1e52

Please sign in to comment.