aboutsummaryrefslogtreecommitdiff
path: root/syrette_macros/src/libs/intertrait_macros/args.rs
blob: a49567fac9a4029066fd525e9a9dc6813b7105a4 (plain)
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
/**
 * Originally from Intertrait by CodeChain
 *
 * https://github.com/CodeChain-io/intertrait
 * https://crates.io/crates/intertrait/0.2.2
 *
 * Licensed under either of
 *
 * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
 * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

 * at your option.
*/
use syn::parse::{Parse, ParseStream, Result};
use syn::{Path, Token, Type};

pub struct Cast
{
    pub ty: Type,
    pub target: Path,
}

impl Parse for Cast
{
    fn parse(input: ParseStream) -> Result<Self>
    {
        let ty: Type = input.parse()?;

        input.parse::<Token![=>]>()?;

        Ok(Cast {
            ty,
            target: input.parse()?,
        })
    }
}