(input: &'a DeriveInput)
| 10 | |
| 11 | impl<'a> Container<'a> { |
| 12 | pub fn new(input: &'a DeriveInput) -> Result<Self> { |
| 13 | let container_attributes = get_attributes(&input.attrs)?; |
| 14 | |
| 15 | let mut crate_name = None; |
| 16 | |
| 17 | for (key, value) in container_attributes { |
| 18 | if key.is_ident("crate") { |
| 19 | crate_name = Some(match value { |
| 20 | Lit::Str(lit_str) => lit_str.parse::<Path>(), |
| 21 | bad => Err(Error::new_spanned( |
| 22 | bad, |
| 23 | "Invalid value for #[table(crate = \"crate_path\")]", |
| 24 | )), |
| 25 | }?); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | let mut container_builder = Container::builder(&input.ident); |
| 30 | |
| 31 | if let Some(crate_name) = crate_name { |
| 32 | container_builder.crate_name(crate_name); |
| 33 | } |
| 34 | |
| 35 | Ok(container_builder.build()) |
| 36 | } |
| 37 | |
| 38 | fn builder(name: &'a Ident) -> ContainerBuilder<'a> { |
| 39 | ContainerBuilder::new(name) |
nothing calls this directly
no test coverage detected