This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is only a test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct t{ | |
a: u32, | |
b: u32 | |
} | |
fn main() { | |
let mut test: t; | |
test.a = 16; | |
test.b = 12; | |
let res: u32 = test.a*test.b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Test { | |
a: u32, | |
b: u32, | |
} | |
impl Test { | |
fn new(a: u32, b: u32) -> Test { | |
Test { a, b } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(specialization)] | |
pub struct MemberBase { | |
id: u32, | |
} | |
impl MemberBase { | |
pub fn id(&self) -> u32 { self.id } | |
} | |
pub trait UiMemberSpecialization { | |
fn size(&self) -> (u32, u32); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Testing{ | |
one: Option<String> | |
} | |
impl Testing { | |
/// redis://[:<passwd>@]<hostname>[:port][/<db>] | |
pub fn do_something(&self) { | |
let one = &self.one.unwrap_or_default(); | |
println!("one is: {:?}", one); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Testing{ | |
one: Option<String> | |
} | |
impl Testing { | |
/// redis://[:<passwd>@]<hostname>[:port][/<db>] | |
pub fn do_something(&self) { | |
let one = self.one.as_ref().unwrap(); | |
println!("one is: {:?}", one); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let mut v = vec![1, 2, 3, 4, 5]; | |
let first = &v[0]; | |
v.push(6); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//play.rust-lang.org | |
fn main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate chrono; | |
use chrono::prelude::*; | |
fn main() { | |
let datetime = Utc.ymd(2020, 1, 1).and_hms(0, 0, 0); | |
let timestamp = datetime.timestamp(); | |
let naive_datetime = NaiveDateTime::from_timestamp(timestamp, 0); | |
let datetime_again: DateTime<Utc> = DateTime::from_utc(naive_datetime, Utc); | |
println!("{}", datetime_again); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn greet_world() { | |
println!("Hello, world!"); // our old friend. | |
let southern_germany = "Grüß Gott!"; | |
let japan = "ハロー・ワールド"; | |
let regions = [southern_germany, japan]; | |
for region in ®ions { | |
println!("{}", region); |
OlderNewer