pub unsafe trait NonBlockCallback {
// Required method
fn call(sound: Sound, result: Result<()>) -> Result<()>;
}
Expand description
Callback to be called when a sound has finished loading, or a non blocking seek is occuring.
Return code currently ignored.
Note that for non blocking streams a seek could occur when restarting the sound after the first playthrough. This will result in a callback being triggered again.
§Safety
Since this callback can occur from the async thread, there are restrictions about what functions can be called during the callback.
All Sound
functions are safe to call, except for Sound::set_sound_group
and Sound::release
.
It is also safe to call System::get_userdata
.
The rest of the Core API and the Studio API is not allowed. Calling a non-allowed function will return Error::InvalidThread
.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.