Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar

Leopard627 leopard627

  • South Korea
  • 18:51 (UTC +09:00)
View GitHub Profile
#[test]
fn indexed_string_test() {
let mut s = "hello slice literal";
let is_okay = &s[0..1];
let is_not_okay = &s[1];
fn build_computer(name: String, model: String) -> Computer {
Computer {
name: name,
model: model,
cpu: 8,
ram_size: 1024,
}
}
@leopard627
leopard627 / submodule_pull.sh
Created January 22, 2019 09:16
git submodule update --init --recursive
git submodule update --init --recursive
@leopard627
leopard627 / gist:b5b7098f021b1bb22a4e7ae0e5b6f357
Created January 19, 2019 16:02 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
enum DDD {
s(String)
}
enum AAA {
TellMe(DDD)
}
enum Message {
Quit,
Move {x: i32, y: i32},
Write(String),
ChangeColor(i32, i32, i32),
}
impl Message {
fn call(&self) {
println!("Called~!!");
enum IpAddrKind {
V4(String),
V6(String)
}
enum IpAddrKindV2 {
V4(u8, u8, u8, u8),
V6(String)
}
#[test]
fn method_test() {
let apple_ii = Computer{
serial: String::from("APPLEISBEST!!"),
model: String::from("APPLE II"),
cpu: 32,
ram: 1024 * 100,
};
#[derive(Debug)]
struct Computer {
serial: String,
model: String,
cpu: u32,
ram: u64,
}
impl Computer {
#[derive(Debug)]
struct Computer {
serial: String,
model: String,
cpu: u32,
ram: u64,
}