pub struct InputEvent { /* private fields */ }Expand description
One safe input event to write into the buffer supplied by SCS.
Implementations§
Source§impl InputEvent
impl InputEvent
pub const fn new(index: InputIndex, value: InputValue) -> InputEvent
pub const fn index(self) -> InputIndex
pub const fn value(self) -> InputValue
Sourcepub unsafe fn write_to(
self,
output: *mut ScsInputEvent,
expected_type: InputValueType,
) -> Result<(), SdkError>
pub unsafe fn write_to( self, output: *mut ScsInputEvent, expected_type: InputValueType, ) -> Result<(), SdkError>
Writes this event into a live SDK output buffer after type validation.
The official callback contract gives the plugin a reusable output buffer and requires it to populate the index plus the union member that matches the registered input type. This method deliberately leaves the inactive union tail untouched instead of replacing the entire raw structure. Besides matching the official sample, that avoids copying bytes for inactive or future-extension storage whose contents have no meaning for the current value.
§Errors
Returns SdkError::InvalidParameter when output is null or when the
event value does not match the value type registered for that input.
§Safety
output must identify the live scs_input_event_t supplied to the
current input callback. The callback must be executing directly on the
SCS game main thread.
Trait Implementations§
Source§impl Clone for InputEvent
impl Clone for InputEvent
Source§fn clone(&self) -> InputEvent
fn clone(&self) -> InputEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more