Skip to main content

frame_owned

Function frame_owned 

Source
pub fn frame_owned(
    backend: &mut impl Backend,
    state: &mut AppState,
    config: &RunConfig,
    events: Vec<Event>,
    f: &mut impl FnMut(&mut Context),
) -> Result<bool>
Expand description

Process a single UI frame, taking ownership of the events Vec (zero-copy).

Like frame, but accepts an owned Vec<Event> to avoid the to_vec() copy frame performs internally. Prefer this in high-frequency custom render loops where you already own the event buffer.

§Example

let events: Vec<slt::Event> = collect_events();
let keep_going = slt::frame_owned(
    &mut my_backend,
    &mut state,
    &config,
    events,
    &mut |ui| { ui.text("hello"); },
)?;