pub fn create_custom_owned_pcm_source<S: CustomPcmSource + 'static>(
    custom_source: S,
) -> CustomOwnedPcmSource {
    let adapter = PcmSourceAdapter::new(custom_source);
    // Create the C++ counterpart source (we need to box the Rust side twice in order to obtain
    // a thin pointer for passing it to C++ as callback target).
    let rust_source: Box<Box<dyn reaper_low::PCM_source>> = Box::new(Box::new(adapter));
    let thin_ptr_to_adapter: NonNull<_> = rust_source.as_ref().into();
    let raw_cpp_source = unsafe { create_cpp_to_rust_pcm_source(thin_ptr_to_adapter) };
    let cpp_source = unsafe { OwnedPcmSource::new_unchecked(PcmSource::new(raw_cpp_source)) };
    CustomOwnedPcmSource {
        cpp_source,
        _rust_source: rust_source,
    }
}
/// Unstable!!!
///
/// Creates a REAPER PCM source for the given custom Rust implementation and returns it.
//
// TODO-high-unstable Think of a good name.
Unstable
Creates a REAPER PCM source for the given custom Rust implementation and returns it.


Unstable Creates a REAPER PCM source for the given custom Rust implementation and returns it .
pub fn create_custom_owned_pcm_source<S: CustomPcmSource + 'static>(
    custom_source: S,
) -> CustomOwnedPcmSource {
    let adapter = PcmSourceAdapter::new(custom_source);
    // Create the C++ counterpart source (we need to box the Rust side twice in order to obtain
    // a thin pointer for passing it to C++ as callback target).
    let rust_source: Box<Box<dyn reaper_low::PCM_source>> = Box::new(Box::new(adapter));
    let thin_ptr_to_adapter: NonNull<_> = rust_source.as_ref().into();
    let raw_cpp_source = unsafe { create_cpp_to_rust_pcm_source(thin_ptr_to_adapter) };
    let cpp_source = unsafe { OwnedPcmSource::new_unchecked(PcmSource::new(raw_cpp_source)) };
    CustomOwnedPcmSource {
        cpp_source,
        _rust_source: rust_source,
    }
}
pub fn create_custom_owned_pcm_source < S : CustomPcmSource + ' static > ( custom_source : S , ) -> CustomOwnedPcmSource { let adapter = PcmSourceAdapter :: new ( custom_source ) ; // Create the C++ counterpart source (we need to box the Rust side twice in order to obtain // a thin pointer for passing it to C++ as callback target). let rust_source : Box < Box < dyn reaper_low :: PCM_source > > = Box :: new ( Box :: new ( adapter ) ) ; let thin_ptr_to_adapter : NonNull < _ > = rust_source . as_ref ( ) . into ( ) ; let raw_cpp_source = unsafe { create_cpp_to_rust_pcm_source ( thin_ptr_to_adapter ) } ; let cpp_source = unsafe { OwnedPcmSource :: new_unchecked ( PcmSource :: new ( raw_cpp_source ) ) } ; CustomOwnedPcmSource { cpp_source , _rust_source : rust_source , } }
Unstable!!!
Unstable!!!
custom_source
S
custom_source
S