MCPcopy Create free account
hub / github.com/biblius/validify / parse_in_full

Function parse_in_full

validify_derive/src/validate/parser.rs:333–362  ·  view source on GitHub ↗
(meta: &ParseNestedMeta, not: bool)

Source from the content-addressed store, hash-verified

331}
332
333pub 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
364pub fn parse_ip_full(meta: &ParseNestedMeta) -> Result<Ip, syn::Error> {
365 let mut validation = Ip::default();

Callers 1

parse_single_validationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected