This file contains 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 mock<T: Into<String>, I: IntoIterator<Item = T>>(_: I) {} | |
struct Merchant<'a> { | |
name: &'a str, | |
billing_portal: &'a str, | |
billing_period: &'a str, | |
stripe_id: Option<&'a str>, | |
} | |
fn merchant() -> Merchant { unimplemented!(); } |
This file contains 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
struct Inner { | |
a: A, | |
} | |
impl Inner { | |
fn fun(&mut self) { | |
self.a.something(); | |
} | |
fn fun2(&mut self, outer: &Arc<Outer>) { | |
self.a.something2(outer.b); |
This file contains 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(specialization)] | |
struct Baz; | |
trait Foo<T> { | |
fn bar(); | |
} | |
default impl<T> Foo<Baz> for T { | |
fn bar() { |
This file contains 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::net::SocketAddr; | |
use hyper::{Body, http, Request, Response, Server, StatusCode}; | |
use hyper::service::{make_service_fn, service_fn}; | |
#[tokio::main] | |
async fn main() { | |
let addr = SocketAddr::from(([127, 0, 0, 1], 3030)); | |
let make_svc = make_service_fn(|_conn| async { |
This file contains 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::thread; | |
struct Shitpointer(*mut i32); | |
unsafe impl Send for Shitpointer {} | |
fn main() { | |
let mut v: Vec<i32> = vec![1, 3, 3, 7]; | |
let ptr_1 = Shitpointer(v.as_mut_ptr()); | |
let ptr_2 = Shitpointer(v.as_mut_ptr()); | |
This file contains 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
#![allow(unused)] | |
use std::collections::HashMap; | |
use std::io; | |
struct PhoneEntry { | |
name: String, | |
phone: String, | |
} | |
impl PhoneEntry { |
This file contains 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 serde::{Serialize, Deserialize}; // 1.0.97 | |
use serde_json::{self, Value}; // 1.0.40 | |
//use std::collections::HashMap; | |
#[derive(Serialize, Deserialize, Debug)] | |
struct Stuff { | |
a: i32, | |
#[serde(flatten)] | |
extra: Maybe, |
This file contains 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(unsize)] | |
use std::alloc::Layout; | |
use std::marker::{PhantomData, Unsize}; | |
use std::mem; | |
/// Assumes pointer-sized metadata | |
#[repr(C)] | |
struct DstPointerRepr { | |
data: *mut (), |
This file contains 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
struct Foo<T, C> where C: Fn() -> T { | |
make_t: C, | |
value: Option<T>, | |
} | |
impl<T, C> Foo<T, C> where C: Fn() -> T { | |
fn new(make_t: C) -> Foo<T, C> { | |
Foo { | |
make_t, | |
value: None |
This file contains 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::process::{Command, Stdio}; | |
fn main() { | |
let mut rev = Command::new("rev") | |
.stdin(Stdio::piped()) | |
.stdout(Stdio::inherit()) | |
.stderr(Stdio::inherit()) | |
.spawn() | |
.expect("rev failed to spawn"); |
NewerOlder