edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | use crate::; |
| 2 | |
| 3 | /// A marker trait for types that can be stored in GPUI's global state. |
| 4 | /// |
| 5 | /// This trait exists to provide type-safe access to globals by ensuring only |
| 6 | /// types that implement [`Global`] can be used with the accessor methods. For |
| 7 | /// example, trying to access a global with a type that does not implement |
| 8 | /// [`Global`] will result in a compile-time error. |
| 9 | /// |
| 10 | /// Implement this on types you want to store in the context as a global. |
| 11 | /// |
| 12 | /// ## Restricting Access to Globals |
| 13 | /// |
| 14 | /// In some situations you may need to store some global state, but want to |
| 15 | /// restrict access to reading it or writing to it. |
| 16 | /// |
| 17 | /// In these cases, Rust's visibility system can be used to restrict access to |
| 18 | /// a global value. For example, you can create a private struct that implements |
| 19 | /// [`Global`] and holds the global state. Then create a newtype struct that wraps |
| 20 | /// the global type and create custom accessor methods to expose the desired subset |
| 21 | /// of operations. |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | /// A trait for reading a global value from the context. |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | /// A trait for updating a global value in the context. |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 |