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

Function payload_path_angle_bracketed

validify_derive/src/payload.rs:269–288  ·  view source on GitHub ↗
(path: &mut syn::TypePath)

Source from the content-addressed store, hash-verified

267}
268
269fn payload_path_angle_bracketed(path: &mut syn::TypePath) {
270 // Type is contained in a List<T>. It will always have angle args and will
271 // always be the last segment of the path
272 let syn::PathArguments::AngleBracketed(ref mut args) =
273 path.path.segments.last_mut().unwrap().arguments
274 else {
275 abort!(path.span(), "Cannot apply payload type to field")
276 };
277
278 let syn::GenericArgument::Type(syn::Type::Path(ref mut p)) = args.args.last_mut().unwrap()
279 else {
280 abort!(path.span(), "Cannot apply payload type to field")
281 };
282
283 let Some(segment) = p.path.segments.last_mut() else {
284 abort!(p.span(), "Invalid path provided for validify")
285 };
286
287 segment.ident = format_ident!("{}Payload", segment.ident);
288}
289
290#[allow(dead_code)]
291/// Could come in handy, parses the inner contents of an angle bracketed path and outputs

Callers 1

map_payload_fieldsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected