fix(host): align descriptor and publication identity
This commit is contained in:
@@ -160,7 +160,9 @@ impl InterfaceRegistry {
|
||||
///
|
||||
/// `validator` should be present when the host intends the reference to
|
||||
/// represent a versioned descriptor. Its presence makes the same value a
|
||||
/// mandatory precondition for dispatch.
|
||||
/// mandatory precondition for dispatch. Registration finalizes the
|
||||
/// descriptor's protocol `name` to the assigned opaque reference so it
|
||||
/// corresponds directly to [`Object::interfaces`].
|
||||
pub fn register<D>(
|
||||
&mut self,
|
||||
_definition: D,
|
||||
@@ -174,7 +176,7 @@ impl InterfaceRegistry {
|
||||
return Err(RegistrationError::AlreadyRegistered);
|
||||
}
|
||||
|
||||
let descriptor = D::descriptor();
|
||||
let mut descriptor = D::descriptor();
|
||||
descriptor
|
||||
.validate()
|
||||
.map_err(RegistrationError::InvalidDescriptor)?;
|
||||
@@ -183,6 +185,11 @@ impl InterfaceRegistry {
|
||||
"wip-interface:{}:{}",
|
||||
self.namespace, self.next_reference
|
||||
));
|
||||
// The protocol model currently carries the interface identifier in the
|
||||
// descriptor's `name` field. Finalize that identity to the same opaque
|
||||
// reference placed on published objects; the generated Rust trait name
|
||||
// is registration-local metadata, not wire identity.
|
||||
descriptor.name = reference.0.clone();
|
||||
self.next_reference = self
|
||||
.next_reference
|
||||
.checked_add(1)
|
||||
|
||||
Reference in New Issue
Block a user