Skip to content

Instantly share code, notes, and snippets.

@Kimundi
Created January 28, 2013 22:09
Show Gist options
  • Select an option

  • Save Kimundi/4659639 to your computer and use it in GitHub Desktop.

Select an option

Save Kimundi/4659639 to your computer and use it in GitHub Desktop.
trait ConvTo<T> {
fn to(&self) -> T;
}
impl i8: ConvTo<u8> {
fn to(&self) -> u8 { *self as u8 }
}
impl i8: ConvTo<u16> {
fn to(&self) -> u16 { *self as u16 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment