Skip to content

Instantly share code, notes, and snippets.

Nemo157 Nemo157

Block or report user

Report or block Nemo157

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
View rustc.main-{{closure}}.-------.generator_resume.0.mir
// MIR for `main::{{closure}}`
// source = MirSource { def_id: DefId(0/1:9 ~ generators[317d]::main[0]::{{closure}}[0]), promoted: None }
// pass_name = generator_resume
// disambiguator = 0
// generator_layout = GeneratorLayout { fields: [LocalDecl { mutability: Not, is_user_variable: Some(Set(Var(VarBindingForm { binding_mode: BindByValue(MutImmutable), opt_ty_info: None, opt_match_place: Some((None, src/test/debuginfo/generators.rs:37:17: 37:18)), pat_span: src/test/debuginfo/generators.rs:37:13: 37:14 }))), internal: false, is_block_tail: None, ty: i32, user_ty: UserTypeProjections { contents: [] }, name: Some(d), source_info: SourceInfo { span: src/test/debuginfo/generators.rs:37:13: 37:14, scope: scope[2] }, visibility_scope: scope[1] }] }
fn main::{{closure}}(_1: std::pin::Pin<&mut [generator@src/test/debuginfo/generators.rs:36:17: 41:6 a:&mut i32 {i32, ()}]>) -> std::ops::GeneratorState<(), ()>{
let mut _0: std::ops::GeneratorState<(), ()>; // return place
scope 1 {
}
View record-struct-middleware-1-variadics.rs
trait App<Input>
where
Input: { request: http::Request }
{
type Output: Into<http::Response>;
fn call(self, input: Input) -> Self::Output;
}
struct AuthApp<T> {
View Cargo.toml
[package]
name = "foo"
version = "0.1.0"
authors = ["Wim Looman <wim@nemo157.com>"]
edition = "2018"
[[bin]]
name = "foo"
path = "main.rs"
View playground.rs
#![feature(arbitrary_self_types, generators, generator_trait, pin)]
use std::{
marker::Unpin,
ops::{DerefMut, Deref, Generator, GeneratorState},
pin::Pin,
};
trait PinIterator {
type Item;
View keybase.md

Keybase proof

I hereby claim:

  • I am nemo157 on github.
  • I am nemo157 (https://keybase.io/nemo157) on keybase.
  • I have a public key ASD1nVnDDI5Cp5WsBc513ncqywdomif0qkol8hTYsP_9Rgo

To claim this, I am signing this object:

@Nemo157
Nemo157 / generator_sink.rs
Last active Sep 6, 2017
An attempt at working out how to shim an argument accepting generator into a Sink
View generator_sink.rs
pub enum GeneratorState<Y, R> { Yielded(Y), Complete(R) }
pub trait Generator {
type Yield;
type Return;
type Argument;
fn resume(&mut self, Self::Argument) -> GeneratorState<Self::Yield, Self::Return>;
}
enum Arg<T> { StartSend(T), Poll, Close }
View with.md

Examples

Basic example

catch {
    let decoded = bs58::decode("he11owor1d").into_vec()?;
    let encoded = bs58::encode(decoded).into_string();
    assert_eq!("he11owor1d", encoded);
}
View castofkings-s5.rss
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>A Cast of Kings: Season 5</title>
<description>Recreated podcost containing old episodes of "A Cast of Kings" for my personal use</description>
<lastBuildDate>Sat, 23 Jul 2016 12:00:00 +0000</lastBuildDate>
<item>
<title>S5 Post-season</title>
<enclosure url="http://traffic.libsyn.com/slashfilmcast/CastofKingsPost5Bonus.mp3" length="0" type="audio/mpeg" />
</item>
View castofkings-s4.rss
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>A Cast of Kings: Season 4</title>
<description>Recreated podcost containing old episodes of "A Cast of Kings" for my personal use</description>
<lastBuildDate>Sun, 3 Jul 2016 12:00:00 +0000</lastBuildDate>
<item>
<title>S4 - Wrapup</title>
<link>http://www.slashfilm.com/</link>
<pubDate>Mon, 23 Jun 2014 00:00:00 +0000</pubDate>
View castofkings-s2.rss
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>A Cast of Kings: Season 3</title>
<description>Recreated podcost containing old episodes of "A Cast of Kings" for my personal use</description>
<lastBuildDate>Sun, 3 Jul 2016 12:00:00 +0000</lastBuildDate>
<item>
<title>S3 - Wrapup</title>
<link>http://www.slashfilm.com/</link>
<pubDate>Sun, 7 Jul 2013 00:00:00 +0000</pubDate>
You can’t perform that action at this time.