fn property_value_as_utee_value_codes()

in optee-utee-build/src/code_generator.rs [275:297]


fn property_value_as_utee_value_codes(
    var_name: &str,
    value: &PropertyValue,
) -> proc_macro2::TokenStream {
    proc_macro2::TokenStream::from_str(
        match value {
            PropertyValue::U32(_) => format!("&{} as *const u32 as *mut _", var_name),
            PropertyValue::U64(_) => format!("&{} as *const u64 as *mut _", var_name),
            PropertyValue::Bool(_) => format!("&{} as *const bool as *mut _", var_name),
            PropertyValue::Uuid(_) => {
                format!("&{} as *const optee_utee_sys::TEE_UUID as *mut _", var_name)
            }
            PropertyValue::Str(_) => format!("{} as *const [u8] as *mut _", var_name),
            PropertyValue::BinaryBlock(_) => format!("{} as *const [u8] as *mut _", var_name),
            PropertyValue::Identity(..) => format!(
                "&{} as *const optee_utee_sys::TEE_Identity as *mut _",
                var_name
            ),
        }
        .as_str(),
    )
    .unwrap()
}