aws_smithy_observability/
context.rs

1/*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6/// Delineates a logical scope that has some beginning and end
7/// (e.g. a function or block of code).
8pub trait Scope {
9    /// invoke when the scope has ended.
10    fn end(&self);
11}
12
13/// A cross cutting concern for carrying execution-scoped values across API
14/// boundaries (both in-process and distributed).
15pub trait Context {
16    /// Make this context the currently active context.
17    /// The returned handle is used to return the previous
18    /// context (if one existed) as active.
19    fn make_current(&self) -> &dyn Scope;
20}
21
22/// Keeps track of the current [Context].
23pub trait ContextManager {
24    ///Get the currently active context.
25    fn current(&self) -> &dyn Context;
26}