Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
use crate::headers::{HeaderName, HeaderValue, Headers, ToHeaderValues};
struct CustomHeader {}
impl CustomHeader {
/// Create a new instance of `CustomHeader`.
fn new() -> Self {
todo!();
}
PS C:\Users\yoshu\Code\rust> py ./x.py build
Updating only changed submodules
Submodules updated in 0.26 seconds
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Finished dev [unoptimized + debuginfo] target(s) in 2.21s
Building stage0 std artifacts (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc)
Finished release [optimized] target(s) in 0.62s
Copying stage0 std from stage0 (x86_64-pc-windows-msvc -> x86_64-pc-windows-msvc / x86_64-pc-windows-msvc)
Building LLVM for x86_64-pc-windows-msvc

Pre-requisites

Should have a functioning Rust install already through rustup. This means the Visual Studio 2019 build tools also need to be installed.

Install deps

With winget installed do:

$ winget install python
@yoshuawuyts
yoshuawuyts / tracing_log.rs
Created June 29, 2020 19:11 — forked from KodrAus/tracing_log.rs
Converting between `tracing` key values and `log` key values
use std::fmt;
use log::kv::{self, Source, value::{self, Fill}};
use tracing::{Value, Field, field::{self, Visit}};
#[doc(hidden)]
pub struct LogField<'kvs>(&'kvs Field, &'kvs dyn Value);
impl fmt::Debug for LogField<'_> {
const { Client } = require('undici')
const client = new Client(`unix:///tmp/hello.sock`)
client.request({
path: '/',
method: 'GET'
}, function (err, data) {
if (err) throw err
const {
pub use accept_encoding::Encoding;
use async_compression::stream;
use futures::future::BoxFuture;
use http::{header::CONTENT_ENCODING, status::StatusCode, HeaderMap};
use http_service::Body;
use crate::{
middleware::{Middleware, Next},
response::IntoResponse,
@yoshuawuyts
yoshuawuyts / arch-linux-install.md
Created May 19, 2019 21:57 — 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
@yoshuawuyts
yoshuawuyts / playground.rs
Created September 16, 2019 02:59 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#[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 September 2, 2019 18:42 — forked from rust-play/playground.rs
Code shared from the Rust Playground
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 September 1, 2019 12:06 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#[macro_export]
macro_rules! info {
// info!("...")
($e:expr) => {
$crate::info_impl!(($e));
};
// info!("...", args...)
($e:expr, $($rest:tt)*) => {
$crate::info_impl!(($e) $($rest)*);