1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#![cfg_attr(feature = "better-docs",
    cfg_attr(all(), doc = include_str!("lib.md")),
)]
#![cfg_attr(feature = "nightly", feature(
    // Nightly features.
    doc_auto_cfg,
    doc_notable_trait,
))]
#![cfg_attr(not(feature = "better-docs"),
    doc = "See [crates.io](https://crates.io/crates/next-gen)"
)]
#![cfg_attr(not(feature = "better-docs"),
    doc = "for more info about this crate."
)]

#![allow(nonstandard_style)]
#![warn(missing_docs)]
#![deny(unused_must_use)]
#![doc(test(attr(deny(warnings), allow(unused), deny(unused_must_use))))]

#![no_std]

#[cfg(test)]
extern crate self as next_gen;

macro_rules! use_prelude {() => (
    #[allow(unused_imports)]
    use crate::utils::prelude_internal::*;
)}

use_prelude!();

#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate std;

/// Transforms a function with `yield_!` calls into a generator.
#[cfg_attr(feature = "better-docs", cfg_attr(all(), doc = concat!(
    "\n", "# Example",
    "\n", "",
    "\n", "```rust",
    // "\n", "# const _: &str = ::core::stringify! {", "\n",
    "\n", include_str!("doc_examples/generator.rs"),
    // "\n", "# };",
    "\n", "```",
)))]
///
/// # Expansion
///
/// The above example expands to:
#[cfg_attr(feature = "better-docs", cfg_attr(all(), doc = concat!(
    "\n", "",
    "\n", "```rust",
    // "\n", "# const _: &str = ::core::stringify! {",
    "\n", include_str!("doc_examples/generator_desugared.rs"),
    // "\n", "# };",
    "\n", "```",
)))]
pub use ::next_gen_proc_macros::generator;

pub use {
    // ::{
    //     next_gen_proc_macros::generator,
    // },
    // self::{
    //     // coroutine::*,
    //     // generator::*,
    //     // ops::{Generator, GeneratorState},
    // },
};

pub mod generator;
pub mod generator_fn;
pub mod prelude;

mod iter;
mod public_macros;
mod utils;
mod waker;

#[path = "macro_internals.rs"]
#[doc(hidden)] /** Not part of the public API */ pub
mod __;

#[cfg(test)]
mod tests;