rust-jack
rust-jack copied to clipboard
Make ProcessCallbacks struct public
Changes:
Made ProcessCallbacks public in lib.rs.
Why?
When creating an AsyncClient using client.activate_async and using a handler with state, the ProcessCallbacks type is needed if you want to annotate the type of the AsyncClient
For example:
fn some_function(
) -> anyhow::Result<AsyncClient<Notifications, ClosureProcessHandler<State, ProcessCallbacks<impl FnMut(&mut State, &Client, &ProcessScope) -> Control, impl FnMut(&mut State, &Client, Frames) -> Control>>>> {
let process_callback = move |state: &mut State, client: &Client, ps: &ProcessScope| -> Control {
Control::Continue
};
let buffer_callback = |state: &mut State, client: &Client, len: Frames| -> Control {
Control::Continue
};
let handler = ClosureProcessHandler::with_state(Jack::default(), process_callback, buffer_callback);
let active_client = client.activate_async(notifications, handler)?;
Ok(active_client)
}
I found that I can also type the client using impl ProcessHandler to avoid this issue:
fn some_function() -> anyhow::Result<AsyncClient<Notifications, impl ProcessHandler> {