genawaiter-macro-0.99.1/Cargo.toml.orig000064400000000000000000000007131363130262700161200ustar0000000000000000[package] name = "genawaiter-macro" version = "0.99.1" authors = ["Devin R "] license = "MIT/Apache-2.0" description = "Convenience macros for generators (genawaiter)" edition = "2018" repository = "https://github.com/whatisaphone/genawaiter" readme = "../README.md" keywords = ["generator", "yield", "coroutine", "async", "await"] categories = ["asynchronous", "concurrency", "rust-patterns"] [features] strict = [] proc_macro = [] genawaiter-macro-0.99.1/Cargo.toml0000644000000017301363130374700124650ustar00# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies # # If you believe there's an error in this file please file an # issue against the rust-lang/cargo repository. If you're # editing this file be aware that the upstream Cargo.toml # will likely look very different (and much more reasonable) [package] edition = "2018" name = "genawaiter-macro" version = "0.99.1" authors = ["Devin R "] description = "Convenience macros for generators (genawaiter)" readme = "../README.md" keywords = ["generator", "yield", "coroutine", "async", "await"] categories = ["asynchronous", "concurrency", "rust-patterns"] license = "MIT/Apache-2.0" repository = "https://github.com/whatisaphone/genawaiter" [features] proc_macro = [] strict = [] genawaiter-macro-0.99.1/src/lib.rs000064400000000000000000000034501362215441600151360ustar0000000000000000#![warn(future_incompatible, rust_2018_compatibility, rust_2018_idioms, unused)] #![warn(clippy::cargo, clippy::pedantic)] #![cfg_attr(feature = "strict", deny(warnings))] #[macro_export] #[cfg(feature = "proc_macro")] macro_rules! stack_let_gen { ($name:ident, $body:expr $(,)?) => { ::genawaiter::stack::let_gen_using!( $name, ::genawaiter::stack_producer!($body), ); }; } #[macro_export] macro_rules! stack_let_gen_using { ($name:ident, $producer:expr $(,)?) => { // Safety: The goal here is to ensure the safety invariants of `Gen::new`, i.e., // the lifetime of the `Co` argument (in `$producer`) must not outlive `shelf` // or `generator`. // // We create two variables, `shelf` and `generator`, which cannot be named by // user-land code (because of macro hygiene). Because they are declared in the // same scope, and cannot be dropped before the end of the scope (because they // cannot be named), they have equivalent lifetimes. The type signature of // `Gen::new` ties the lifetime of `co` to that of `shelf`. This means it has // the same lifetime as `generator`, and so the invariant of `Gen::new` cannot // be violated. let mut shelf = ::genawaiter::stack::Shelf::new(); let mut generator = unsafe { ::genawaiter::stack::Gen::new(&mut shelf, $producer) }; let $name = &mut generator; }; } #[macro_export] #[cfg(feature = "proc_macro")] macro_rules! rc_gen { ($body:expr) => { ::genawaiter::rc::Gen::new(::genawaiter::rc_producer!($body)) }; } #[macro_export] #[cfg(feature = "proc_macro")] macro_rules! sync_gen { ($body:expr) => { ::genawaiter::sync::Gen::new(::genawaiter::sync_producer!($body)) }; } genawaiter-macro-0.99.1/.cargo_vcs_info.json0000644000000001121363130374700144600ustar00{ "git": { "sha1": "f48046a9f66fbd2e535d5614fa7fe0d0b1a6a046" } }