pub fn new<T>(callback: Box<T>) -> OwnedAudioHookRegister
    where
        T: OnAudioBuffer + 'static,
    {
        OwnedAudioHookRegister {
            inner: audio_hook_register_t {
                OnAudioBuffer: Some(delegating_on_audio_buffer::<T>),
                // boxed_callback_struct is not a fat pointer. Even if it would be, thanks to
                // generics the callback knows what's the concrete type and therefore can restore
                // the original type correctly without needing the vtable part of the fat
                // pointer.
                userdata1: encode_user_data(&callback),
                userdata2: null_mut(),
                input_nch: 0,
                output_nch: 0,
                GetBuffer: None,
            },
            callback,
        }
    }
/// Creates an audio hook register.
///
/// See [`audio_reg_hardware_hook_add`].
///
/// # Design
///
/// Taking ownership of the user-defined piece of data releases the API consumer of the burden
/// of maintaining a stable memory address and ensuring correct lifetime.
///
/// [`audio_reg_hardware_hook_add`]:
/// struct.ReaperSession.html#method.audio_reg_hardware_hook_add
Creates an audio hook register.
Creates an audio hook register .
pub fn new<T>(callback: Box<T>) -> OwnedAudioHookRegister
    where
        T: OnAudioBuffer + 'static,
    {
        OwnedAudioHookRegister {
            inner: audio_hook_register_t {
                OnAudioBuffer: Some(delegating_on_audio_buffer::<T>),
                // boxed_callback_struct is not a fat pointer. Even if it would be, thanks to
                // generics the callback knows what's the concrete type and therefore can restore
                // the original type correctly without needing the vtable part of the fat
                // pointer.
                userdata1: encode_user_data(&callback),
                userdata2: null_mut(),
                input_nch: 0,
                output_nch: 0,
                GetBuffer: None,
            },
            callback,
        }
    }
pub fn new < T > ( callback : Box < T > ) -> OwnedAudioHookRegister where T : OnAudioBuffer + ' static , { OwnedAudioHookRegister { inner : audio_hook_register_t { OnAudioBuffer : Some ( delegating_on_audio_buffer :: < T > ) , // boxed_callback_struct is not a fat pointer. Even if it would be, thanks to // generics the callback knows what's the concrete type and therefore can restore // the original type correctly without needing the vtable part of the fat // pointer. userdata1 : encode_user_data ( & callback ) , userdata2 : null_mut ( ) , input_nch : 0 , output_nch : 0 , GetBuffer : None , } , callback , } }
Creates an audio hook register.
Creates an audio hook register .
callback
Box<T>
callback
Box<T>
design
Taking ownership of the user-defined piece of data releases the API consumer of the burden
of maintaining a stable memory address and ensuring correct lifetime.

[`audio_reg_hardware_hook_add`]:
struct.ReaperSession.html#method.audio_reg_hardware_hook_add
Taking ownership of the user - defined piece of data releases the API consumer of the burden of maintaining a stable memory address and ensuring correct lifetime . [ ` audio_reg_hardware_hook_add ` ] : struct . ReaperSession . html#method . audio_reg_hardware_hook_add