pub fn provide_context_ref<'a, T: 'static>(cx: Scope<'a>, value: &'a T) -> &'a T
Expand description

Provides a context in the current Scope. The context can later be accessed by using use_context lower in the scope hierarchy.

The context can also be accessed in the same scope in which it is provided.

Unlike provide_context, this method accepts a reference that lives at least as long as the scope.

Panics

This method panics if a context with the same type exists already in this scope. Note that if a context with the same type exists in a parent scope, the new context will shadow the old context.