diesel_derives/deprecated/utils.rs
1use syn::parse::{ParseStream, Result};
2use syn::token::Eq;
3use syn::{Ident, LitStr};
4
5pub fn parse_eq_and_lit_str(name: Ident, input: ParseStream, help: &str) -> Result<LitStr> {
6 if input.is_empty() {
7 return Err(syn::Error::new(
8 name.span(),
9 format!(
10 "unexpected end of input, expected `=`\n\
11 help: The correct format looks like `#[diesel({help})]`"
12 ),
13 ));
14 }
15
16 input.parse::<Eq>()?;
17 input.parse::<LitStr>()
18}