get object id
Some checks failed
CI / Rust checks (push) Failing after 38s

This commit is contained in:
2024-10-21 13:46:57 +02:00
parent cfc5e4ad87
commit 4088df3d5e

View File

@@ -34,6 +34,16 @@ impl SimConnect {
.ok_or(SimConnectError::ObjectNotRegistered(type_name))
}
pub fn get_object_id<T: SimConnectObjectExt>(&self) -> Result<u32, SimConnectError> {
let type_name: String = std::any::type_name::<T>().into();
Ok(self
.registered_objects
.get(&type_name)
.ok_or_else(|| SimConnectError::ObjectNotRegistered(type_name.clone()))?
.id)
}
/// Add a Microsoft Flight Simulator simulation variable name to a client defined object definition.
///
/// # Remarks