MCPcopy Create free account
hub / github.com/apache/fory / field_dispatch_for

Function field_dispatch_for

rust/fory-derive/src/object/field_codec.rs:439–466  ·  view source on GitHub ↗
(
    ty: &Type,
    meta: &ForyFieldMeta,
    nullable: bool,
    track_ref: bool,
)

Source from the content-addressed store, hash-verified

437}
438
439fn field_dispatch_for(
440 ty: &Type,
441 meta: &ForyFieldMeta,
442 nullable: bool,
443 track_ref: bool,
444) -> syn::Result<FieldDispatch> {
445 if meta.array {
446 let codec_ty = codec_type_for(ty, meta, nullable, track_ref)?;
447 return Ok(FieldDispatch::Codec { codec_ty });
448 }
449 if meta.encoding.is_none()
450 && meta.list.is_none()
451 && !meta.array
452 && meta.map.is_none()
453 && is_container_type(ty)
454 && !is_vec_type(ty)
455 && !contains_custom_trait_object(ty)
456 && !contains_any_object(ty)
457 {
458 return Ok(FieldDispatch::Serializer {
459 field_type: field_type_expr_for(ty, nullable, track_ref)?,
460 has_generics: true,
461 });
462 }
463 Ok(FieldDispatch::Codec {
464 codec_ty: codec_type_for(ty, meta, nullable, track_ref)?,
465 })
466}
467
468pub(crate) fn codec_type_for(
469 ty: &Type,

Callers 1

build_bindingsFunction · 0.85

Calls 7

codec_type_forFunction · 0.85
is_container_typeFunction · 0.85
is_vec_typeFunction · 0.85
contains_any_objectFunction · 0.85
field_type_expr_forFunction · 0.85
is_noneMethod · 0.45

Tested by

no test coverage detected