(meta: &ParseNestedMeta, not: bool)
| 331 | } |
| 332 | |
| 333 | pub fn parse_in_full(meta: &ParseNestedMeta, not: bool) -> Result<In, syn::Error> { |
| 334 | let mut validation = In::new(not); |
| 335 | |
| 336 | meta.parse_nested_meta(|meta| { |
| 337 | if meta.path.is_ident("collection") { |
| 338 | let content = meta.value()?; |
| 339 | match content.parse::<syn::Expr>() { |
| 340 | Ok(expr) => { |
| 341 | validation.expr = Some(expr); |
| 342 | } |
| 343 | Err(e) => { |
| 344 | return Err( |
| 345 | meta.error(format!("[not_]in collection must be a valid path ({e})")) |
| 346 | ) |
| 347 | } |
| 348 | } |
| 349 | return Ok(()); |
| 350 | } |
| 351 | |
| 352 | code_and_message!(validation, meta); |
| 353 | |
| 354 | Err(meta.error("Unrecognized [not_]in parameter, accepted are: collection, code, message")) |
| 355 | })?; |
| 356 | |
| 357 | if validation.expr.is_none() { |
| 358 | abort!(meta.input.span(), "[not_]in validation must have a path") |
| 359 | } |
| 360 | |
| 361 | Ok(validation) |
| 362 | } |
| 363 | |
| 364 | pub fn parse_ip_full(meta: &ParseNestedMeta) -> Result<Ip, syn::Error> { |
| 365 | let mut validation = Ip::default(); |
no outgoing calls
no test coverage detected