1#![allow(clippy::missing_safety_doc)]
2
3pub mod api;
4pub mod error;
5pub mod traits;
6
7#[allow(unused_imports, unused_unsafe, unsafe_op_in_unsafe_fn, clippy::all)]
8pub mod ffi_dispatch {
9 include!(concat!(env!("OUT_DIR"), "/ffi_dispatch.rs"));
10}
11pub mod console;
12pub mod containers;
13pub mod delegate_registry;
14pub mod dynamic_call;
15pub mod ffi_guard;
16pub mod fname;
17pub mod input;
18pub mod logging;
19pub mod object_ref;
20pub mod pinned;
21pub mod reify_registry;
22pub mod script_interface;
23pub mod soft_ref;
24pub mod struct_ref;
25pub mod subclass_of;
26pub mod task;
27pub mod ue_math;
28pub mod weak_ptr;
29pub mod widget;
30pub mod world;
31
32pub use api::{api, init_api};
33pub use console::{CommandContext, ConsoleVariable};
34pub use containers::{ContainerElement, OwnedStruct, UeArray, UeMap, UeSet};
35pub use delegate_registry::DelegateBinding;
36pub use dynamic_call::{DynamicCall, DynamicCallResult};
37pub use error::{
38 ErrorContext, ErrorKind, RustealError, RustealResult, UeSubject, check_ffi, check_ffi_ctx,
39 ffi_infallible, ffi_infallible_ctx,
40};
41pub use ffi_guard::ffi_boundary;
42pub use logging::{LOG_DISPLAY, LOG_ERROR, LOG_WARNING};
43pub use object_ref::{Checked, ObjectPointer, UObjectRef};
44pub use pinned::Pinned;
45pub use script_interface::ScriptInterface;
46pub use soft_ref::SoftObjectRef;
47pub use struct_ref::UStructRef;
48pub use subclass_of::SubclassOf;
49pub use traits::{
50 HasParent, Inherits, UeClass, UeEnum, UeHandle, UeInterface, UeStruct, ValidHandle,
51};
52
53pub use fname::FName;
54pub use struct_ref::{OutRef, out_ref_from_param, struct_ref_from_param};
55pub use ue_math::{
56 BoxSphereBounds, Color, LinearColor, Plane, Ray, Rotator, Sphere, Transform, UeBox, UeBox2d,
57};
58pub use weak_ptr::TWeakObjectPtr;
59
60pub use rusteal_ffi::{
61 FNameHandle, FPropertyHandle, FWeakObjectHandle, RustealErrorCode, UClassHandle, UObjectHandle,
62 UStructHandle,
63};
64
65use std::sync::{Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
66
67pub(crate) fn lock_or_recover<T>(m: &Mutex<T>) -> MutexGuard<'_, T> {
68 m.lock().unwrap_or_else(|e| e.into_inner())
69}
70
71pub(crate) fn read_or_recover<T>(m: &RwLock<T>) -> RwLockReadGuard<'_, T> {
72 m.read().unwrap_or_else(|e| e.into_inner())
73}
74
75pub(crate) fn write_or_recover<T>(m: &RwLock<T>) -> RwLockWriteGuard<'_, T> {
76 m.write().unwrap_or_else(|e| e.into_inner())
77}