Struct sdl2::Sdl

source ·
pub struct Sdl { /* private fields */ }
Expand description

The SDL context type. Initialize with sdl2::init().

From a thread-safety perspective, Sdl represents the main thread. As such, Sdl is a useful type for ensuring that SDL types that can only be used on the main thread are initialized that way.

For instance, SDL_PumpEvents() is not thread safe, and may only be called on the main thread. All functionality that calls SDL_PumpEvents() is thus put into an EventPump type, which can only be obtained through Sdl. This guarantees that the only way to call event-pumping functions is on the main thread.

Implementations

Initializes the audio subsystem.

Initializes the event subsystem.

Initializes the joystick subsystem.

Initializes the haptic subsystem.

Initializes the game controller subsystem.

Initializes the timer subsystem.

Initializes the video subsystem.

Obtains the SDL event pump.

At most one EventPump is allowed to be alive during the program’s execution. If this function is called while an EventPump instance is alive, the function will return an error.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.