# Idea: Optics types, combining pattern types and view types

**URL:** <https://internals.rust-lang.org/t/idea-optics-types-combining-pattern-types-and-view-types/24526>\
**Category:** language design\
**Created:** [August 12, 2026, 5:54am UTC](https://internals.rust-lang.org/t/idea-optics-types-combining-pattern-types-and-view-types/24526 "2026-08-12T05:54:12Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![frank-king](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/frank-king/32/8765_2.png) [@frank-king](https://internals.rust-lang.org/u/frank-king)\
**Post date:** [August 13, 2026, 1:45am UTC](https://internals.rust-lang.org/t/idea-optics-types-combining-pattern-types-and-view-types/24526/8 "2026-08-13T01:45:27Z")

</div>

There can also be some variations of `optics_type!(Bar is B(_) => C { .. })`:

| Type | Before called | After returns (Output) | After returns (Residual) | After unwinds |
| --- | --- | --- | --- | --- |
| `optics_type!(Bar is B(_) => C { .. })` | `B(_)` | `C { .. }` | `C { .. }` | `B(_) | C { .. }` |
| `optics_type!(Bar is B(_) |=> C { .. })` | `B(_)` | `B(_) | C { .. }` | `B(_) | C { .. }` | `B(_) | C { .. }` |
| `optics_type!(Bar is B(_) ?=> C { .. })` | `B(_)` | `C { .. }` | `B(_) | C { .. }` | `B(_) | C { .. }` |
| `optics_type!(Bar is B(_) !=> C { .. })` | `B(_)` | `C { .. }` | `C { .. }` | `C { .. }` |

where `?=>` only applies to functions returning `impl Try`.

---

_[View the full topic](https://internals.rust-lang.org/t/idea-optics-types-combining-pattern-types-and-view-types/24526)._
