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

        new_context
    }
/// Returns a clone of the current thread's context with the given value.
///
/// This is a more efficient form of `Context::current().with_value(value)`
/// as it avoids the intermediate context clone.
///
/// # 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 and attach context with the first value set to "a"
/// let _guard = Context::new().with_value(ValueA("a")).attach();
///
/// // And create another context based on the fist with a new value
/// let all_current_and_b = Context::current_with_value(ValueB(42));
///
/// // The second context now contains all the current values and the addition
/// assert_eq!(all_current_and_b.get::<ValueA>(), Some(&ValueA("a")));
/// assert_eq!(all_current_and_b.get::<ValueB>(), Some(&ValueB(42)));
/// ```
Returns a clone of the current thread's context with the given value.
This is a more efficient form of `Context::current().with_value(value)`
as it avoids the intermediate context clone.
Returns a clone of the current thread ' s context with the given value . This is a more efficient form of ` Context :: current () . with_value ( value ) ` as it avoids the intermediate context clone .
pub fn current_with_value<T: 'static + Send + Sync>(value: T) -> Self {
        let mut new_context = Context::current();
        new_context
            .entries
            .insert(TypeId::of::<T>(), Arc::new(value));
        new_context
    }
pub fn current_with_value < T : ' static + Send + Sync > ( value : T ) -> Self { let mut new_context = Context :: current ( ) ; new_context . entries . insert ( TypeId :: of :: < T > ( ) , Arc :: new ( value ) ) ; new_context }
Returns a clone of the current thread's context with the given value.
Returns a clone of the current thread ' s context with the given value .
value
T
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 and attach context with the first value set to "a"
let _guard = Context::new().with_value(ValueA("a")).attach().

And create another context based on the fist with a new value
let all_current_and_b = Context::current_with_value(ValueB(42)).

The second context now contains all the current values and the addition
assert_eq!(all_current_and_b.get::(), Some(&ValueA("a")));
assert_eq!(all_current_and_b.get::(), Some(&ValueB(42)));
```
struct ValueB ( u64 ) . You can create and attach context with the first value set to " a " let _guard = Context :: new () . with_value ( ValueA ( " a " )) . attach () . And create another context based on the fist with a new value let all_current_and_b = Context :: current_with_value ( ValueB ( 42 )) . The second context now contains all the current values and the addition assert_eq! ( all_current_and_b . get :: () Some ( &ValueA ( " a " ))) ; assert_eq! ( all_current_and_b . get :: () Some ( &ValueB ( 42 ))) ; ` ` `