# gpui: Improve \`Global\` ergonomics \(\#11923\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c1e291bc965e3f3c23969dead1ed93c4cc4502ae)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c1e291bc965e3f3c23969dead1ed93c4cc4502ae

Requested commit: c1e291bc965e3f3c23969dead1ed93c4cc4502ae

Commit: c1e291bc965e3f3c23969dead1ed93c4cc4502ae

Tree: c3d2843251d8060fbb909d3aa68890f301fba5d7

Author: Marshall Bowers

Committer: GitHub

## Message

```
gpui: Improve `Global` ergonomics (#11923)

This PR adds some ergonomic improvements when working with GPUI
`Global`s.

Two new traits have been added—`ReadGlobal` and `UpdateGlobal`—that
provide associated functions on any type that implements `Global` for
accessing and updating the global without needing to call the methods on
the `cx` directly (which generally involves qualifying the type).

I looked into adding `ObserveGlobal` as well, but this seems a bit
trickier to implement as the signatures of `cx.observe_global` vary
slightly between the different contexts.

Release Notes:

- N/A
```

## Parents

- [1b261608c6a5a2bae5f2edb363584b39dd74295f](https://git.cafe/gitcafe/zed/commit/1b261608c6a5a2bae5f2edb363584b39dd74295f?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c1e291bc965e3f3c23969dead1ed93c4cc4502ae?format=markdown)
