FLValue_FromData

Function FLValue_FromData 

Source
pub unsafe extern "C" fn FLValue_FromData(
    data: FLSlice,
    trust: FLTrust,
) -> FLValue
Expand description

Returns a pointer to the root value in the encoded data, or NULL if validation failed. You should generally use an \ref FLDoc instead; it’s safer. Here’s why:

On the plus side, \ref FLValue_FromData is extremely fast: it allocates no memory, only scans enough of the data to ensure it’s valid (and if trust is set to kFLTrusted, it doesn’t even do that.)

But it’s potentially very dangerous: the FLValue, and all values found through it, are only valid as long as the input data remains intact and unchanged. If you violate that, the values will be pointing to garbage and Bad Things will happen when you access them…