To use SDL3, you must first initialize the library using sdl3::init(). This returns an Sdl context object. The Sdl object represents the main thread and is used to obtain access to various subsystems (audio, video, etc.).
Important Threading Rule: Sdl must be initialized on the main thread. If you attempt to initialize it from a different thread, it will return an error unless you enable the test-mode feature (intended for cargo test).
When the Sdl object is dropped, SDL_Quit() is automatically called, cleaning up the library.
let sdl_context = sdl3::init().unwrap();
// Use sdl_context to access subsystems...