Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous inconsistencies #422

Open
ids1024 opened this issue Oct 19, 2023 · 0 comments
Open

Miscellaneous inconsistencies #422

ids1024 opened this issue Oct 19, 2023 · 0 comments

Comments

@ids1024
Copy link
Member

ids1024 commented Oct 19, 2023

There are a few inconsistencies in sctk currently. That might be worth thinking about for the next breaking version.

  • It would make sense if ProvidesBoundGlobal were implemented for every type in the crate that provides a global.
    • But by the requirements of the trait, as defined, it can't be implemented for things like dmabuf, for which sctk supports versions 3 and 4. Both of which seem important to support now.
      • Could be defined as an enum of states by version, each of which implements ProvidesBoundGlobal for different versions, or methods returning things that return ProvidesBoundGlobal, but those are awkward...
  • Some wrappers around globals have names ending in *State but some don't.
  • Some have a constructor called ::new while others have one called ::bind
  • Handling of protocols/globals that may or may not exist
    • Shm::bind returns an error if the global doesn't exist; but implementing ShmHandler requires returning the Shm (I guess if the protocol somehow is optional for a client, it could store an Option<Shm>, and define shm_state with .as_mut().unwrap()?)
    • Some other state types have constructors that always succeed, but methods returning a GlobalError result. ProvidesBoundGlobal handles this. Methods may fail regardless if they need a newer protocol version.

The use of methods on state types as helpers for sending requests is occasionally inconvenient if one wants to send requests from another thread... though in the worst cast those can be done directly. Not sure if there's a good way to define helpers than handle this case well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant