File: simple.rs

package info (click to toggle)
rust-libcst-derive 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 132 kB
  • sloc: makefile: 2
file content (54 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (2)
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
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree

use libcst_derive::cst_node;

#[derive(Debug, PartialEq, Eq, Clone)]
pub struct WS<'a>(&'a str);

type TokenRef<'r, 'a> = &'r &'a str;

#[cst_node]
pub enum Foo<'a> {
    One(One<'a>),
    Two(Box<Two<'a>>),
}

#[cst_node]
pub struct One<'a> {
    pub two: Box<Two<'a>>,
    pub header: WS<'a>,

    pub(crate) newline_tok: TokenRef<'a>,
}

#[cst_node]
pub struct Two<'a> {
    pub whitespace_before: WS<'a>,
    pub(crate) tok: TokenRef<'a>,
}

#[cst_node]
struct Thin<'a> {
    pub whitespace: WS<'a>,
}

#[cst_node]
struct Value<'a> {
    pub value: &'a str,
}

#[cst_node]
struct Empty {}

#[cst_node]
enum Smol<'a> {
    #[allow(dead_code)]
    Thin(Thin<'a>),
    #[allow(dead_code)]
    Empty(Empty),
}

fn main() {}