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,
) -> RustealResult<Self>
pub fn new( obj: &UObjectRef<impl UeClass>, func_name: &str, ) -> RustealResult<Self>
Prepare a reflection call to the named function on obj.
Sourcepub fn for_delegate(
obj: &UObjectRef<impl UeClass>,
delegate: FPropertyHandle,
) -> RustealResult<Self>
pub fn for_delegate( obj: &UObjectRef<impl UeClass>, delegate: FPropertyHandle, ) -> RustealResult<Self>
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: Copy>(&mut self, name: &str, value: T) -> RustealResult<()>
Sourcepub fn set_struct<T: UeStruct>(
&mut self,
name: &str,
value: &OwnedStruct<T>,
) -> RustealResult<()>
pub fn set_struct<T: UeStruct>( &mut self, name: &str, value: &OwnedStruct<T>, ) -> RustealResult<()>
Copy a struct into a parameter with the struct’s own copy semantics.
Sourcepub fn broadcast(self) -> RustealResult<()>
pub fn broadcast(self) -> RustealResult<()>
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.