Add complete downstream API gate
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:
@@ -170,6 +170,9 @@ SUPPORT_TYPES = {
|
||||
MEMBER_RETURN_OVERRIDES = {
|
||||
"M:LibreMetaverse.Caps.Capabilities": "Vec<String>",
|
||||
}
|
||||
TYPE_NAME_OVERRIDES = {
|
||||
"T:LibreMetaverse.LslTools.Error": "LslError",
|
||||
}
|
||||
BOXED_FIELD_IDS = {
|
||||
"F:LibreMetaverse.Caps.Simulator",
|
||||
"F:LibreMetaverse.Simulator.Caps",
|
||||
@@ -296,7 +299,9 @@ def declared_type_path(assembly: str, item: dict) -> tuple[str, str, str]:
|
||||
base, _, _ = type_parts(item["signature"])
|
||||
tail = base[len(item["namespace"]) :].lstrip(".")
|
||||
# Flatten nested type ownership into the type name; the containing type keeps paths unique.
|
||||
type_name = "".join(pascal(part) for part in tail.split("."))
|
||||
type_name = TYPE_NAME_OVERRIDES.get(
|
||||
item["doc_id"], "".join(pascal(part) for part in tail.split("."))
|
||||
)
|
||||
module = "::".join(modules)
|
||||
path = "::".join([crate.replace("-", "_"), *modules, type_name])
|
||||
return crate, module, path
|
||||
@@ -639,7 +644,9 @@ def member_signature(mapper: Mapper, owner: dict, item: dict, rust_name: str) ->
|
||||
return " ; ".join(pieces), ",".join([*self_ownership, *own]) or "none", asyncness, error_model, "accessor_methods"
|
||||
if kind == "event":
|
||||
event_type = mapper.type(item["type"], item.get("nullability"), generics)
|
||||
return f"pub fn subscribe_{rust_name}(&self, handler: {event_type}) -> libremetaverse_types::compat::Subscription", "stored_callback", asyncness, error_model, "subscription_guard"
|
||||
arguments = f"handler: {event_type}" if item.get("static") else f"&self, handler: {event_type}"
|
||||
ownership = "stored_callback" if item.get("static") else "shared_self,stored_callback"
|
||||
return f"pub fn subscribe_{rust_name}({arguments}) -> libremetaverse_types::compat::Subscription", ownership, asyncness, error_model, "subscription_guard"
|
||||
self_argument, self_ownership = method_receiver(owner, item)
|
||||
arguments = ", ".join(filter(None, [self_argument, parameters]))
|
||||
ownership = ",".join(([self_ownership] if self_ownership != "none" else []) + own) or "none"
|
||||
|
||||
Reference in New Issue
Block a user