Skip to content

Instantly share code, notes, and snippets.

use actix_codec::{BytesCodec, Framed};
use futures::StreamExt;
use parking_lot::Mutex;
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::Arc;
use std::time::Duration;
use tokio::net::TcpListener;
use tokio::runtime::current_thread;
#[macro_use]
extern crate criterion;
use criterion::{Criterion, ParameterizedBenchmark};
use std::collections::HashMap;
use std::rc::{Rc, Weak};
use std::cell::UnsafeCell;
type Sessions = Rc<UnsafeCell<HashMap<String, Data>>>;
@nayato
nayato / launch.json
Created April 5, 2018 13:55 — forked from puffybsd/launch.json
VSCode launcher for rust using lldb
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug-LLDB",
"type": "lldb",
"request": "launch",
"program": "${workspaceRoot}/target/debug/${workspaceRootFolderName}",
"args": [],
"cwd": "${workspaceRoot}",
@nayato
nayato / Dockerfile
Last active May 8, 2023 13:36
Dockerfile for rust multistage build sample
FROM rustlang/rust:nightly as builder
WORKDIR /app/src
RUN USER=root cargo new --bin ht
COPY Cargo.toml Cargo.lock ./ht/
WORKDIR /app/src/ht
RUN cargo build --release
COPY ./ ./
RUN cargo build --release
@nayato
nayato / README.md
Created December 11, 2017 19:04 — forked from ihrwein/README.md
Building minimal Rust containers with Docker multi stage builds

The built image for a hello world project is less than 8 MB.

Builder image (it'd be best to upload this image to Docker Hub. This is 100% percent reusable).

FROM ubuntu:latest

ENV TARGET=x86_64-unknown-linux-musl
ENV BUILD_DIR=/src/target/x86_64-unknown-linux-musl/release/
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Bash on Windows Launch",
"type": "cppdbg",
"request": "launch",
"program": "/mnt/c/.../target/debug/examples/testapp", // path to crate root here, change executable
"args": [],
"stopAtEntry": false,
@nayato
nayato / erasure.rs
Created October 12, 2017 20:09 — forked from anonymous/playground.rs
Rust code shared from the playground
fn main() {
let a = Test(None);
a.print();
let b = Test(Some(23));//Box::new(Test(Some(23)));
b.print();
print_it(&b);
}
struct Test (Option<i32>);
@nayato
nayato / sasl-expanded.rs
Created September 18, 2017 18:04
SASL exchange in rust-amqp1 expanded
#![feature(prelude_import)]
#![no_std]
#![feature(proc_macro, conservative_impl_trait, generators)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
extern crate amqp1 as amqp;
extern crate futures_await as futures;
extern crate tokio_io;
@nayato
nayato / tools.md
Created July 14, 2017 00:45 — forked from nrc/tools.md
Rust tooling

Rust developer tools - status and strategy

Availability and quality of developer tools are an important factor in the success of a programming language. C/C++ has remained dominant in the systems space in part because of the huge number of tools tailored to these lanaguages. Succesful modern languages have had excellent tool support (Java in particular, Scala, Javascript, etc.). Finally, LLVM has been successful in part because it is much easier to extend than GCC. So far, Rust has done pretty well with developer tools, we have a compiler which produces good quality code in reasonable time, good support for debug symbols which lets us leverage C++/lanaguge agnostic tools such as debuggers, profilers, etc., there are also syntax highlighting, cross-reference, code completion, and documentation tools.

In this document I want to layout what Rust tools exist and where to find them, highlight opportunities for tool developement in the short and long term, and start a discussion about where to focus our time an