# \[IDEA\] Implied enum types

**URL:** <https://internals.rust-lang.org/t/idea-implied-enum-types/18349>\
**Category:** language design\
**Created:** [February 15, 2023, 3:02am UTC](https://internals.rust-lang.org/t/idea-implied-enum-types/18349 "2023-02-15T03:02:31Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![scottmcm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/scottmcm/32/2355_2.png) [@scottmcm](https://internals.rust-lang.org/u/scottmcm)\
**Post date:** [February 15, 2023, 6:59am UTC](https://internals.rust-lang.org/t/idea-implied-enum-types/18349/4 "2023-02-15T06:59:47Z")

</div>

Reusing my posts from the last few times:

> [@Auto infer namespaces on struct and enum instantiations](https://internals.rust-lang.org/t/auto-infer-namespaces-on-struct-and-enum-instantiations/14764/29):
>
> This is true for C enums, but is not my experience for Rust enums -- because they're so much richer they often also have extensive and interesting methods and trait implementations too. For a braced struct, I find that I often care less about the type name than for enums, because the field names help. .Skip doesn't tell me nearly as much as CookieHandling::Skip, but .{ window\_length: 4096, dictionary\_size: 1 \<\< 16, level: 9 } is useful without knowing that those are on a CompressionOptions st…

> [@\[Pre-RFC\] Inferred Enum Type](https://internals.rust-lang.org/t/pre-rfc-inferred-enum-type/16100/19):
>
> To me, the awkward thing about adding this is that it could easily lead to needing to change the conventions for how variants are named. Something like make\_webrequest(CookieHandling::Skip) is perfectly readable, but make\_webrequest(\_::Skip) is pretty confusing. So because the latter syntax doesn't exist, a variant name of Skip is reasonable today, but might not be good later. But if people end up wanting to do \_::SkipCookies, that's the kind of repetitive naming (CookieHandling::SkipCookies)…

> [@Enum path inference with \`\_Variant\` syntax](https://internals.rust-lang.org/t/enum-path-inference-with-variant-syntax/16851/19):
>
> Well, the whole existence of inference is about not writing types, as is method syntax. It's interesting that it's .map(|x| x.ok()), but .map(Result::ok). If \_::Variant works, though, should .map(\_::ok) work too? I don't know. Here's a previous post with a bunch of examples of places where inference already allows APIs that can do things without saying the types involved: But the situation that seems most clear to me is in struct literals. Options { cookie\_handling: CookieHandling::…

---

_[View the full topic](https://internals.rust-lang.org/t/idea-implied-enum-types/18349)._
