Skip to content

Exclude operator/keyword in modules? #3846

@Phosphorus-M

Description

@Phosphorus-M

Basically, I haven't found a simple way to exclude exported elements of a module, in some cases (maybe edge cases) I want to export everything in a prelude EXCEPT! for a specific struct or trait, that forces me to export manually everything:

pub use axum::extract::{
    ConnectInfo,
    DefaultBodyLimit,
    Extension,
    Form,
    FromRef,
    FromRequest,
    FromRequestParts,
    // Json, I want to exclude this structure, so manually I export everything and I comment this line ✨
    MatchedPath,
    NestedPath,
    OptionalFromRequest,
    OptionalFromRequestParts,
    OriginalUri,
    Path,
    Query,
    RawForm,
    RawPathParams,
    RawQuery,
    Request,
    State,
};

And maybe we can provide a slightly more ergonomic way to do the same, something like this:

pub use axum::extract::*;
priv use axum::extract::Json;

That must export everything in axum::extract excluding axum::extract::Json and we are providing a functionality to the reserved keyword priv

It's just an idea, but I want to hear some comments about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions