Skip to main content

EnvironmentArg

Trait EnvironmentArg 

Source
pub trait EnvironmentArg {
    // Required method
    fn environment(self, view: View) -> View;
}
Expand description

A value .environment(_:_:) can write.

Swift’s is environment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, _ value: V), one modifier over every property. Each property is a separate entry point here because each needs its own key path, so the trait puts them back behind one spelling — the argument’s type choosing the property, the way the key path does in Swift.

Required Methods§

Source

fn environment(self, view: View) -> View

Write this value into view’s environment.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§