Skip to content

Instantly share code, notes, and snippets.

@Arnavion
Arnavion / doc.md
Created September 8, 2017 03:09
tiny-async-await

A tiny crate that provides async and await macros to create futures::Futures and futures::Streams.

Code that uses these macros requires #![feature(conservative_impl_trait, generators)]

  • Returning a futures::Future

     #![feature(conservative_impl_trait, generators)]
    
     #[macro_use]
@Arnavion
Arnavion / make_deserializable.rs
Last active October 3, 2016 16:27
Macro for deserializing structs from JSON for Rust stable
//! Exports a single macro named make_deserializable that can be used in place of #[derive(serde::Deserialize)] on structs.
//! Supports regular structs and tuple structs of u64.
//! Only works with JSON deserialization.
//!
//! Eg: make_deserializable!(struct Foo { bar: String, baz: i32, });
//! Eg: make_deserializable!(struct Bar(u64));
macro_rules! impl_deserialize_struct {
(struct $struct_name:ident {
$($field_name:ident: $field_type:ty,)*