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

Method fory_write

rust/fory-core/src/serializer/arc.rs:31–70  ·  view source on GitHub ↗
(
        &self,
        context: &mut WriteContext,
        ref_mode: RefMode,
        write_type_info: bool,
        has_generics: bool,
    )

Source from the content-addressed store, hash-verified

29 true
30 }
31 fn fory_write(
32 &self,
33 context: &mut WriteContext,
34 ref_mode: RefMode,
35 write_type_info: bool,
36 has_generics: bool,
37 ) -> Result<(), Error> {
38 match ref_mode {
39 RefMode::None => {
40 // No ref flag - write inner directly
41 if write_type_info {
42 T::fory_write_type_info(context)?;
43 }
44 T::fory_write_data_generic(self, context, has_generics)
45 }
46 RefMode::NullOnly => {
47 // Only null check, no ref tracking
48 context.writer.write_i8(RefFlag::NotNullValue as i8);
49 if write_type_info {
50 T::fory_write_type_info(context)?;
51 }
52 T::fory_write_data_generic(self, context, has_generics)
53 }
54 RefMode::Tracking => {
55 // Full ref tracking with RefWriter
56 if context
57 .ref_writer
58 .try_write_arc_ref(&mut context.writer, self)
59 {
60 // Already written as ref - done
61 return Ok(());
62 }
63 // First occurrence - write type info and data
64 if write_type_info {
65 T::fory_write_type_info(context)?;
66 }
67 T::fory_write_data_generic(self, context, has_generics)
68 }
69 }
70 }
71
72 fn fory_write_data_generic(
73 &self,

Callers

nothing calls this directly

Calls 3

fory_write_type_infoFunction · 0.85
write_i8Method · 0.80
try_write_arc_refMethod · 0.80

Tested by

no test coverage detected