diesel_derives/deprecated/
utils.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use syn::parse::{ParseStream, Result};
use syn::token::Eq;
use syn::{Ident, LitStr};

pub fn parse_eq_and_lit_str(name: Ident, input: ParseStream, help: &str) -> Result<LitStr> {
    if input.is_empty() {
        return Err(syn::Error::new(
            name.span(),
            format!(
                "unexpected end of input, expected `=`\n\
                     help: The correct format looks like `#[diesel({help})]`"
            ),
        ));
    }

    input.parse::<Eq>()?;
    input.parse::<LitStr>()
}