From 8be414f5de6abf018406a7e89d2c8ae2d9e06523 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sat, 25 Nov 2023 00:31:47 +0100 Subject: [PATCH] Add quote of Rust docs --- libwasmvm/src/vtables.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libwasmvm/src/vtables.rs b/libwasmvm/src/vtables.rs index 9f2185acc..642021874 100644 --- a/libwasmvm/src/vtables.rs +++ b/libwasmvm/src/vtables.rs @@ -33,6 +33,10 @@ /// } /// ``` /// +/// Or to say it in the words of [the Rust documentation](https://doc.rust-lang.org/nomicon/ffi.html#the-nullable-pointer-optimization): +/// +/// > So `Option c_int>` is a correct way to represent a nullable function pointer using the C ABI (corresponding to the C type `int (*)(int))`. +/// /// Since all vtable fields are nullable, we can easily demand them /// to have a Default implementation. This sometimes is handy when a /// type is created in Rust and then filled in Go.