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
#[derive(Debug, PartialEq, Eq, Clone)] | |
struct Node<T: Clone> { | |
name: String, | |
value: T, | |
next: Option<Box<Node<T>>> | |
} | |
impl<T: PartialEq + Clone> Node<T> { | |
fn new(name: &str, value: T) -> Self { | |
Node { |
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 text = "ありがとうございます"; | |
let words = text.split("").map(|w| w.as_bytes()).collect::<Vec<&[u8]>>(); | |
let length = words.iter().fold(0, |acc, val| acc + val.len()); | |
println!("Input Text: {}", text); | |
println!("Bytes: {:?}", words); | |
println!("Text is {} bytes long", length); | |
let mut inline_bits = String::new(); |
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
trait Entity { | |
fn walk(&self) -> String; | |
} | |
struct Dog { | |
name: String, | |
age: i32 | |
} | |
impl Dog { |
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(exact_size_is_empty)] | |
use std::io::{self, Read}; | |
use std::process::Command; | |
use std::env; | |
fn main() { | |
let mut entry = String::new(); | |
if env::args().is_empty() { | |
match io::stdin().read_to_string(&mut entry) { | |
Ok(_) => {}, |
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
use std::io::{self, Read}; | |
use std::env; | |
#[derive(Debug)] | |
struct Entity { | |
data: String, | |
iter: Iterat, | |
} | |
#[derive(Debug)] |
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
"time" | |
"github.com/go-zoo/bone" | |
"github.com/go-zoo/claw" | |
mw "github.com/go-zoo/claw/middleware" |
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
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"math/rand" | |
"time" |
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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
) | |
type Maker interface { | |
WriteIn(data []byte) (int, error) |
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
package main | |
import ( | |
"log" | |
"net" | |
"strconv" | |
) | |
type Server struct { | |
Addr string |
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
package main | |
import ( | |
"log" | |
"net" | |
) | |
func main() { | |
data := make([]byte, 1024) | |
list, err := net.Listen("tcp", "localhost:9000") |