pub struct DynamicCall { /* private fields */ }Expand description
Builder for a reflection-based function call.
Typical usage:
let mut call = DynamicCall::new(&obj, "DoSomething")?;
call.set::<i32>("Param1", 42)?;
let result = call.call()?;
let ret: f32 = result.get::<f32>("ReturnValue")?;Implementations§
Source§impl DynamicCall
impl DynamicCall
Sourcepub fn new(
obj: &UObjectRef<impl UeClass>,
func_name: &str,
) -> Result<DynamicCall, RustealError>
pub fn new( obj: &UObjectRef<impl UeClass>, func_name: &str, ) -> Result<DynamicCall, RustealError>
Prepare a reflection call to the named function on obj.
Sourcepub fn for_delegate(
obj: &UObjectRef<impl UeClass>,
delegate: FPropertyHandle,
) -> Result<DynamicCall, RustealError>
pub fn for_delegate( obj: &UObjectRef<impl UeClass>, delegate: FPropertyHandle, ) -> Result<DynamicCall, RustealError>
Write a parameter value into the params buffer.
§Safety contract
T must match the actual UE property type at the named parameter.
Using the wrong type leads to undefined behavior at runtime. This is
inherently less safe than the codegen direct-call path.
Parameters for broadcasting the multicast delegate delegate (a
delegate property) on obj: set them, then DynamicCall::broadcast.
pub fn set<T>(&mut self, name: &str, value: T) -> Result<(), RustealError>where
T: Copy,
Sourcepub fn set_struct<T>(
&mut self,
name: &str,
value: &OwnedStruct<T>,
) -> Result<(), RustealError>where
T: UeStruct,
pub fn set_struct<T>(
&mut self,
name: &str,
value: &OwnedStruct<T>,
) -> Result<(), RustealError>where
T: UeStruct,
Copy a struct into a parameter with the struct’s own copy semantics.
Sourcepub fn broadcast(self) -> Result<(), RustealError>
pub fn broadcast(self) -> Result<(), RustealError>
Invoke the function via ProcessEvent. Consumes this builder and returns
a DynamicCallResult for reading output/return values.
Fire every function bound to the delegate this call was made
for, as C++’s Broadcast does.