Skip to content

Instantly share code, notes, and snippets.

@U007D
Forked from anonymous/playground.rs
Created February 14, 2018 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save U007D/b686d150472992425dcd05dda576eaa6 to your computer and use it in GitHub Desktop.
Save U007D/b686d150472992425dcd05dda576eaa6 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
use std::fmt;
#[derive(Debug, Clone, Copy)]
pub enum CardinalPoint {
North = 0x2191, // ↑
NorthEast = 0x2197, // ↗
East = 0x2192, // →
SouthEast = 0x2198, // ↘
South = 0x2193, // ↓
SouthWest = 0x2199, // ↙
West = 0x2190, // ←
NorthWest = 0x2196, // ↖
}
impl fmt::Display for CardinalPoint {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use std::char;
write!(f, "{}", char::from_u32(*self as u32).unwrap())
}
}
fn main() {
println!("{}", CardinalPoint::North);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment