Skip to content

Rename traits and types to be the same between std and tokio? #25

@TheLostLambda

Description

@TheLostLambda

This one is purely to do with style, so it's only if you think it's a good idea.

Essentially, I've found it a bit unusual to have Std* types everywhere in my project that doesn't use tokio — I reckon (though this is just my intuition), that most people using this library would be using either std or tokio and that mixing is rare? In that case, I think lines like this:

use process_wrap::std::{StdChildWrapper, StdCommandWrap, StdCommandWrapper};

Might look better like this:

use process_wrap::std::{ChildWrapper, CommandWrap, CommandWrapper};

If you did ever have to mix those two types in the same module, then I think it would be perfectly reasonable to just:

use process_wrap::{std, tokio};
// Then refer to the types as:
std::ChildWrapper, std::CommandWrap, std::CommandWrapper
// And
tokio::ChildWrapper, tokio::CommandWrap, tokio::CommandWrapper

There used to be a clippy lint for this (https://rust-lang.github.io/rust-clippy/master/#module_name_repetitions), but it's pretty pedantic, so, again, I think this is up to your preference!

It saves characters most of the time, and only adds two (::) in the worst-case.

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