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
//! Utilities for working with token streams.
//!
//! This is typically a module you will use if you intend to provide a manual
//! implementation of [`FormatInto`].
//!
//! # Examples
//!
//! ```rust
//! use genco::quote_in;
//! use genco::tokens::{from_fn, ItemStr, FormatInto, static_literal};
//! use genco::lang::Lang;
//!
//! /// Format a block comment, starting with `/**`, and ending in `*/`.
//! pub fn block_comment<I, L>(text: I) -> impl FormatInto<L>
//! where
//! I: IntoIterator,
//! I::Item: Into<ItemStr>,
//! L: Lang,
//! {
//! from_fn(move |t| {
//! let mut it = text.into_iter().peekable();
//!
//! if it.peek().is_some() {
//! quote_in! { *t =>
//! $(static_literal("/**"))
//! $(for line in it join ($['\r']) {
//! $[' ']* $(line.into())
//! })
//! $[' ']$(static_literal("*/"))
//! }
//! }
//! })
//! }
//!
//! use genco::prelude::*;
//!
//! let tokens: java::Tokens = quote! {
//! $(block_comment(&["This class is used for awesome stuff", "ok?"]))
//! public static class Foo {
//! }
//! };
//!
//! assert_eq!(
//! vec![
//! "/**",
//! " * This class is used for awesome stuff",
//! " * ok?",
//! " */",
//! "public static class Foo {",
//! "}"
//! ],
//! tokens.to_vec()?
//! );
//! # Ok::<_, genco::fmt::Error>(())
//! ```
pub use ;
pub use FormatInto;
pub use ;
pub use Item;
pub use Kind;
pub use ItemStr;
pub use ;
pub use ;
pub use static_literal;
pub use Tokens;