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

Method fory_default

rust/fory-core/src/serializer/array.rs:306–320  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

304{
305 #[inline(always)]
306 fn fory_default() -> Self {
307 // Create an array by calling fory_default() for each element
308 // We use MaybeUninit for safe initialization
309
310 let mut arr: [MaybeUninit<T>; N] = unsafe { MaybeUninit::uninit().assume_init() };
311 for elem in &mut arr {
312 elem.write(T::fory_default());
313 }
314
315 // Safety: all elements are initialized
316 unsafe {
317 // Transmute from [MaybeUninit<T>; N] to [T; N]
318 std::ptr::read(&arr as *const _ as *const [T; N])
319 }
320 }
321}

Callers

nothing calls this directly

Calls 2

readFunction · 0.70
writeMethod · 0.65

Tested by

no test coverage detected