# Use types only

**URL:** <https://internals.rust-lang.org/t/use-types-only/19773>\
**Category:** language design\
**Created:** [October 28, 2023, 4:34pm UTC](https://internals.rust-lang.org/t/use-types-only/19773 "2023-10-28T16:34:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hydroper1](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/hydroper1/32/12099_2.png) [@hydroper1](https://internals.rust-lang.org/u/hydroper1)\
**Post date:** [October 28, 2023, 4:34pm UTC](https://internals.rust-lang.org/t/use-types-only/19773/1 "2023-10-28T16:34:53Z")

</div>

Allowing `use` to only import types from a module is something that is useful when:

- you have a platform and want to use it as a short namespace, such as `spark::Dialog` instead of `spark::controls::Dialog`;
- you want to export public items from a certain module of the platform, but not, say, modules or functions, because they might conflict (for example, some modules may share a module of equivalent name `support`, used for organization only).

An example crate:

```rust
#[type_use]
pub use self::foo::*;
#[type_use]
pub use self::qux::*;

```

---

<div class="post-metadata">

**Author:** ![bjorn3](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/bjorn3/32/2736_2.png) [@bjorn3](https://internals.rust-lang.org/u/bjorn3)\
**Post date:** [October 28, 2023, 4:52pm UTC](https://internals.rust-lang.org/t/use-types-only/19773/2 "2023-10-28T16:52:26Z")

</div>

If you have two wildcard imports with conflicting names you don't get an error unless you actually try to use the conflicting name. And non-wildcard imports take priority over wildcard imports.

---

<div class="post-metadata">

**Author:** ![SebastianJL](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/sebastianjl/32/10839_2.png) [@SebastianJL](https://internals.rust-lang.org/u/SebastianJL)\
**Post date:** [October 30, 2023, 10:10am UTC](https://internals.rust-lang.org/t/use-types-only/19773/3 "2023-10-30T10:10:56Z")

</div>

Honestly, I haven't yet encountered the case where WildCard imports where better then implicit imports, exactly because of nameclashes. Can you specify why you need to do that?

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [January 28, 2024, 10:11am UTC](https://internals.rust-lang.org/t/use-types-only/19773/4 "2024-01-28T10:11:54Z")

</div>

Closed on January 28, 2024, 10:11am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
