serenity-rs / serenity

A Rust library for the Discord API.
https://discord.gg/serenity-rs
ISC License
4.77k stars 581 forks source link

Flatten serenity::model #2394

Open kangalio opened 1 year ago

kangalio commented 1 year ago

It would be better if all model types were accessible via just serenity::model::ModelType. I don't think anyone can remember which serenity::model submodule a model type belongs to.

This would also make the job of serenity::model::prelude redundant.

A few types should be renamed to be less ambiguous, like Rule and Options.

There should ideally be redirects from the old paths to the new paths.

This needs to wait until at least after #2393

mkrasnitski commented 1 year ago

I'd nominate this to go into 0.13 - since literally every user interacts with the model in some way, this is a breaking change that would be widely felt, and we're already loaded pretty heavy on those for 0.12.

kangalio commented 1 year ago

Good point, I agree

kangalio commented 1 year ago

We could also just add pub use submodule::*; for every model submodule. That way, the old paths stay accessible perfectly accessible, but serenity::model::ModelType also works. That's how I do it in poise: https://docs.rs/poise/latest/poise/#reexports.

What do you think about that?

I think this feature would be very nice for new code written using serenity, to avoid noisy long paths and duplicate-ish imports.

ivinjabraham commented 2 months ago

Is this intended to be open after this message by @mkrasnitski?