Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Yoshua Wuyts yoshuawuyts

🌴
On vacation
Block or report user

Report or block yoshuawuyts

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
@yoshuawuyts
yoshuawuyts / playground.rs
Created Sep 16, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
#[derive(Debug, PartialEq)]
enum State {
Waiting { waiting_time: usize },
Filling { rate: usize },
Done,
Failure(String),
}
#[derive(Debug, Clone, Copy)]
enum Event {
@yoshuawuyts
yoshuawuyts / playground.rs
Created Sep 2, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
macro_rules! fmt_args {
($($tt:tt)*) => {
_fmt_args_!("",; $($tt)*)
};
}
macro_rules! _fmt_args_ {
($fmt:expr, $($args:expr,)*; ) => {
format_args!($fmt $(,$args)*)
};
@yoshuawuyts
yoshuawuyts / kv-log-macro.rs
Last active Sep 1, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View kv-log-macro.rs
#[macro_export]
macro_rules! info {
// info!("...")
($e:expr) => {
$crate::info_impl!(($e));
};
// info!("...", args...)
($e:expr, $($rest:tt)*) => {
$crate::info_impl!(($e) $($rest)*);
@yoshuawuyts
yoshuawuyts / rust.yml
Last active Aug 25, 2019
github ci workflow
View rust.yml
name: Rust
on: [push, pull_request]
jobs:
test:
name: ${{ matrix.rust }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
View browser-args.rs
#[cli]
struct Args {
/// The language of the text.
#[cli(header = "Content-Language")]
lang: String,
/// The current page's description.
#[cli(dom = "head.description")]
desc: String,
}
View chart.rs
// +-----------------------+
// | futures + async/await | --+
// +-----------------------+ +-- Application
// | runtime | --+
// +-----------------------+
// | OS | --+
// +-----------------------+ +-- Platform
// | Hardware | --+
// +-----------------------+
View borrowed-futs.rs
trait AsyncRead {
async fn read(&self, buf: &mut [u8]) -> io::Result<usize>;
}
fn main () {
let mut buf = vec![0; 1024];
let bytes_read = read(&mut buf).await?;
dbg!(buf);
}
@yoshuawuyts
yoshuawuyts / playground.rs
Created Jul 22, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
#![feature(async_await)]
use std::{cell::Cell, future::Future, io, net::SocketAddr, pin::Pin};
pub trait TcpStream {}
impl<T: TcpStream + ?Sized> TcpStream for Pin<Box<T>> {}
pub trait Runtime: Send + Sync + 'static {
type TcpStream: TcpStream;
@yoshuawuyts
yoshuawuyts / playground.rs
Created Jul 22, 2019 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
#![feature(async_await)]
use std::{cell::Cell, future::Future, io, net::SocketAddr, pin::Pin};
pub trait TcpStream {}
impl<T: TcpStream + ?Sized> TcpStream for Pin<Box<T>> {}
pub trait Runtime: Send + Sync + 'static {
type TcpStream: TcpStream;
@yoshuawuyts
yoshuawuyts / arch-linux-install.md
Created May 19, 2019 — forked from jamesmunns/arch-linux-install.md
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
View arch-linux-install.md
You can’t perform that action at this time.