fp-bindgen 3.0.0

Bindings generator for full-stack WASM plugins
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use syn::{ReturnType, Type};

// This is the same as the one in macros/src/lib.rs, which we unfortunately cannot export.
pub(crate) fn normalize_return_type(ty: &ReturnType) -> Option<&Type> {
    match ty {
        ReturnType::Default => None,
        ReturnType::Type(_, ty) => {
            match ty.as_ref() {
                Type::Tuple(tuple) if tuple.elems.is_empty() => {
                    /* An empty '-> ()' return value */
                    None
                }
                r => Some(r),
            }
        }
    }
}