Given a function that's been successfully compiled, serialize it to a blob that the caller may store somewhere for future use by `try_finish_recompile`. As this function requires ownership on the `CompiledCodeStencil`, it gives it back at the end of the function call. The value is left untouched.
(
result: CompiledCodeStencil,
)
| 192 | /// As this function requires ownership on the `CompiledCodeStencil`, it gives it back at the end |
| 193 | /// of the function call. The value is left untouched. |
| 194 | pub fn serialize_compiled( |
| 195 | result: CompiledCodeStencil, |
| 196 | ) -> (CompiledCodeStencil, Result<Vec<u8>, postcard::Error>) { |
| 197 | let cached = CachedFunc { |
| 198 | version_marker: VersionMarker, |
| 199 | stencil: result, |
| 200 | }; |
| 201 | let result = postcard::to_allocvec(&cached); |
| 202 | (cached.stencil, result) |
| 203 | } |
| 204 | |
| 205 | /// An error returned when recompiling failed. |
| 206 | #[derive(Debug)] |