Translate types and utilities tests
Some checks failed
Rust API gates / api-gates (push) Has been cancelled
Some checks failed
Rust API gates / api-gates (push) Has been cancelled
This commit is contained in:
@@ -303,6 +303,13 @@ PRIVATE_LAYOUTS = {
|
||||
"T:LibreMetaverse.StructuredData.OSDUri": [("value", "libremetaverse_types::compat::Uri")],
|
||||
"T:LibreMetaverse.Imaging.ManagedImage": [("data", "Vec<u8>")],
|
||||
}
|
||||
VALUE_DERIVES = {
|
||||
"T:LibreMetaverse.Matrix4": "Clone, Copy, Debug",
|
||||
"T:LibreMetaverse.Quaternion": "Clone, Copy, Debug",
|
||||
"T:LibreMetaverse.UUID": "Clone, Copy, Debug, Default",
|
||||
"T:LibreMetaverse.Vector3": "Clone, Copy, Debug",
|
||||
"T:LibreMetaverse.Vector3d": "Clone, Copy, Debug",
|
||||
}
|
||||
def generic_names(item: dict) -> list[str]:
|
||||
return [parameter["name"] for parameter in item.get("generic_parameters", [])]
|
||||
|
||||
@@ -522,6 +529,8 @@ def render_type(item: dict, type_row: dict, member_rows: dict[str, dict[str, str
|
||||
else:
|
||||
fields = [member for member in item["members"] if member["kind"] == "field" and not member.get("static")]
|
||||
private_fields = PRIVATE_LAYOUTS.get(item["doc_id"], [])
|
||||
if derives := VALUE_DERIVES.get(item["doc_id"]):
|
||||
lines.append(f"#[derive({derives})]")
|
||||
if item["doc_id"] == "T:LibreMetaverse.StructuredData.OSD":
|
||||
lines += [
|
||||
"#[non_exhaustive]",
|
||||
|
||||
Reference in New Issue
Block a user