Skip to content

Instantly share code, notes, and snippets.

The Rust Playground rust-play

Block or report user

Report or block rust-play

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
#![allow(unused_imports)]
use futures::stream::iter_ok;
use std::error::Error;
use std::ops::Add;
use std::sync::Arc;
use std::thread::sleep;
use std::time::Duration;
use tokio::io::{lines, read, read_exact, shutdown, write_all};
use tokio::net::TcpStream;
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
#[derive(Clone, Debug)]
struct FamilyMember {
name: String,
is_parent: bool
}
impl FamilyMember {
fn new_member(new_name: String, parent: bool) -> FamilyMember {
FamilyMember {
name: new_name,
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
#![allow(unused_imports)]
use futures::stream::iter_ok;
use std::error::Error;
use std::ops::Add;
use std::sync::Arc;
use std::thread::sleep;
use std::time::Duration;
use tokio::io::{lines, read, read_exact, shutdown, write_all};
use tokio::net::TcpStream;
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
trait Trait: Sized {
type Assoc;
fn f(&self) -> Enum<Self>;
}
enum Enum<T: Trait> {
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, !");
int a;
}
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
use std::ops::Add;
trait Pipeline<T> {
fn pipe(self, data: T) -> T;
}
impl<T, U> Pipeline<T> for U
where
U: IntoIterator,
U::Item: Fn(T) -> T,
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
use ::std::sync::Arc;
use ::tokio::sync::mpsc; // 0.1.22
struct Bar {
s: Arc<str>,
sender: mpsc::Sender<Data>,
}
#[derive(Debug)]
struct Data {
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
use ::tokio::sync::mpsc; // 0.1.22
struct Bar {
s: String,
sender: mpsc::Sender<Data>,
}
#[derive(Debug)]
struct Data {
s: String,
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
use ::tokio::sync::mpsc; // 0.1.22
struct Bar {
s: Option<String>,
sender: mpsc::Sender<Data>,
}
#[derive(Debug)]
struct Data {
s: String,
@rust-play
rust-play / playground.rs
Created Sep 15, 2019
Code shared from the Rust Playground
View playground.rs
use std::hash::Hash;
use std::collections::HashMap;
use core::fmt::Debug;
struct Cacher<T,U,I>
where T: Fn(U) -> I,
U:Eq+Hash+Copy,
I:Debug+Copy,
{
func:T,
You can’t perform that action at this time.