meilisearch-rust icon indicating copy to clipboard operation
meilisearch-rust copied to clipboard

Better import path

Open irevoire opened this issue 3 years ago • 0 comments

Description It's quite boring to start every file with use meilisearch_sdk::{document::*, client::*}; It would be better if in the lib.rs we were re-exporting every structure like that:

pub use client::*;
pub use index::*;
...

Basic example

And thus let us (=the users) write import like that;

use meilisearch_sdk::*;

Or if you want a few basic structure structures:

use meilisearch_sdk::{Client, Index, Setting};
// instead of
use meilisearch_sdk::{client::Client, indexes::Index, settings::Setting};

Other

Also, I never remember which module name is plural or singular so it would hide our inconsistencies in a non-breaking change.

Another solution would be to provide a prelude like in most libraries but I'm not sure we really need it currently since our lib is so smol :thinking:

irevoire avatar Feb 24 '22 11:02 irevoire