pub struct EnvironmentValues(/* private fields */);Expand description
A borrowed SwiftUI.EnvironmentValues, live for the body call that got it.
The pointer is SwiftUI’s, valid only while the closure that received it is running, which is why this borrows rather than owns.
Implementations§
Source§impl EnvironmentValues
impl EnvironmentValues
Sourcepub unsafe fn bool_at(self, getter: *const c_void) -> bool
pub unsafe fn bool_at(self, getter: *const c_void) -> bool
Read a Bool property by its getter symbol.
EnvironmentValues is resilient, so self travels by address in x20
and the answer comes back in x0. Every Bool property on it has the
same shape, so one function covers all of them.
§Safety
getter must name a (EnvironmentValues) -> Bool property getter.
Sourcepub fn voice_over_enabled(self) -> bool
pub fn voice_over_enabled(self) -> bool
\\.accessibilityVoiceOverEnabled
Sourcepub fn switch_control_enabled(self) -> bool
pub fn switch_control_enabled(self) -> bool
\\.accessibilitySwitchControlEnabled
Sourcepub fn value_for<T: KeyValue>(self, key: &CustomEnvKey<T>) -> T
pub fn value_for<T: KeyValue>(self, key: &CustomEnvKey<T>) -> T
Read a key defined here — env[myKey], through the key path.
swift_getAtKeyPath(sret Value, @in Root, KeyPath): the result is sret
so it goes through x8 while the root is in x0. Whatever nothing above has
written, this returns the key’s defaultValue — which SwiftUI gets from
the synthesised witness, so the default really is the caller’s.
The type comes from the key, so this cannot read a String key as an
Int: the buffer is sized by T’s metadata and +1-owned on return,
which is why it is destroyed after the copy out.