pub fn with_value<T: 'static + Send + Sync>(&self, value: T) -> Self {
        let mut new_context = self.clone();
        new_context
            .entries
            .insert(TypeId::of::<T>(), Arc::new(value));

        new_context
    }
/// Returns a copy of the context with the new value included.
///
/// # Examples
///
/// ```
/// use opentelemetry::Context;
///
/// // Given some value types defined in your application
/// #[derive(Debug, PartialEq)]
/// struct ValueA(&'static str);
/// #[derive(Debug, PartialEq)]
/// struct ValueB(u64);
///
/// // You can create a context with the first value set to "a"
/// let cx_with_a = Context::new().with_value(ValueA("a"));
///
/// // And create another context based on the fist with a new value
/// let cx_with_a_and_b = cx_with_a.with_value(ValueB(42));
///
/// // The first context is still available and unmodified
/// assert_eq!(cx_with_a.get::<ValueA>(), Some(&ValueA("a")));
/// assert_eq!(cx_with_a.get::<ValueB>(), None);
///
/// // The second context now contains both values
/// assert_eq!(cx_with_a_and_b.get::<ValueA>(), Some(&ValueA("a")));
/// assert_eq!(cx_with_a_and_b.get::<ValueB>(), Some(&ValueB(42)));
/// ```
Returns a copy of the context with the new value included.
Returns a copy of the context with the new value included .
pub fn with_value<T: 'static + Send + Sync>(&self, value: T) -> Self {
        let mut new_context = self.clone();
        new_context
            .entries
            .insert(TypeId::of::<T>(), Arc::new(value));
        new_context
    }
pub fn with_value < T : ' static + Send + Sync > ( & self , value : T ) -> Self { let mut new_context = self . clone ( ) ; new_context . entries . insert ( TypeId :: of :: < T > ( ) , Arc :: new ( value ) ) ; new_context }
Returns a copy of the context with the new value included.
Returns a copy of the context with the new value included .
&self
value
T
&self
value
T
examples
```
use opentelemetry::Context.

Given some value types defined in your application
` ` ` use opentelemetry :: Context . Given some value types defined in your application
[derive(debug, partialeq)]
struct ValueA(&'static str).
struct ValueA ( & ' static str ) .
[derive(debug, partialeq)]
struct ValueB(u64).

You can create a context with the first value set to "a"
let cx_with_a = Context::new().with_value(ValueA("a")).

And create another context based on the fist with a new value
let cx_with_a_and_b = cx_with_a.with_value(ValueB(42)).

The first context is still available and unmodified
assert_eq!(cx_with_a.get::(), Some(&ValueA("a")));
assert_eq!(cx_with_a.get::(), None).

The second context now contains both values
assert_eq!(cx_with_a_and_b.get::(), Some(&ValueA("a")));
assert_eq!(cx_with_a_and_b.get::(), Some(&ValueB(42)));
```
struct ValueB ( u64 ) . You can create a context with the first value set to " a " let cx_with_a = Context :: new () . with_value ( ValueA ( " a " )) . And create another context based on the fist with a new value let cx_with_a_and_b = cx_with_a . with_value ( ValueB ( 42 )) . The first context is still available and unmodified assert_eq! ( cx_with_a . get :: () Some ( &ValueA ( " a " ))) ; assert_eq! ( cx_with_a . get :: () None ) . The second context now contains both values assert_eq! ( cx_with_a_and_b . get :: () Some ( &ValueA ( " a " ))) ; assert_eq! ( cx_with_a_and_b . get :: () Some ( &ValueB ( 42 ))) ; ` ` `