#[no_mangle]
pub unsafe extern "C" fn fuchsia_decode_log_messages_to_struct(
msg: *const u8,
size: usize,
expect_extended_attribution: bool,
) -> LogMessages<'static>
Expand description
§Safety
Same as for std::slice::from_raw_parts
. Summarizing in terms of this API:
msg
must be valid for reads forsize
, and it must be properly aligned.msg
must point tosize
consecutive u8 values.- ‘msg’ must outlive the returned LogMessages struct, and must not be free’d until fuchsia_free_log_messages has been called.
- The
size
of the slice must be no larger thanisize::MAX
, and adding that size to data must not “wrap around” the address space. See the safety documentation of pointer::offset. If identity is provided, it must contain a valid moniker and URL.
The returned LogMessages may be free’d with fuchsia_free_log_messages(log_messages). Free’ing the LogMessages struct does the following, in this order:
- Frees memory associated with each individual log message
- Frees the bump allocator itself (and everything allocated from it), as well as the message array itself.