Skip to content

API requires coupling of different modules #685

Open
@mikebenfield

Description

@mikebenfield

Suppose my program has one video module and one audio module. They each use SDL. I don't want the two modules to know about each other, or whether any other part of the program is also using SDL. Maybe the two modules even come from different crates.

With the SDL C API, this is fine. There's a function SDL_WasInit, so each component of my program can check that and initialize if necessary.

With rust-sdl2, as far as I can tell there's no way to hide away SDL in multiple modules like this. Each module has to get access to the Sdl struct, and the only wait to do that is to call init. Once one module has called init, the other module will receive an error from init and can't proceed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions