usc 1.20230730.1349

A common lib for unitedservices
Documentation


use crate::{mysome};
use bevy_reflect::Struct;
use lazy_static::lazy_static;

use serde_json::{json,  Value};
use once_map::OnceMap;

lazy_static! {
     pub  static  ref MYREFLECT_IMPL_DATA: Value = json!({ });
}

pub fn get_oncemap_from_fields<T>(t:&T)->Option<OnceMap<String,String>> where T: Struct {
    let obj:OnceMap<String,String>=OnceMap::new();
    for (i, value) in t.iter_fields().enumerate() {
        let name =mysome!(t.name_at(i),None);
        obj.insert(String::from(name),|_|String::from(value.type_name()));
    }
    Some(obj)
}