This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user