Skip to content

Conversation

@Davvos11
Copy link

@Davvos11 Davvos11 commented Dec 3, 2025

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)
}

@Davvos11
Copy link
Author

Davvos11 commented Dec 3, 2025

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> {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant