pub struct Context { /* private fields */ }Implementations§
Source§impl Context
impl Context
Sourcepub fn with_instance(self, instance: &str) -> Self
pub fn with_instance(self, instance: &str) -> Self
Set an instance name for this context (builder pattern)
This allows the same node implementation to run multiple instances with different names. The node_id becomes “{node_name}/{instance}”.
§Example
// Single instance (no instance name)
let ctx = Context::new("camera_fake").await?;
// node_id: "camera_fake"
// Multi-instance (with instance names)
let left_ctx = Context::new("camera_fake").await?.with_instance("left");
// node_id: "camera_fake/left"
let right_ctx = Context::new("camera_fake").await?.with_instance("right");
// node_id: "camera_fake/right"Sourcepub fn instance(&self) -> Option<&str>
pub fn instance(&self) -> Option<&str>
Get the instance name if set
Returns None for single-instance nodes, or Some(instance) for
multi-instance nodes.
Sourcepub fn get_redis_url() -> Result<String>
pub fn get_redis_url() -> Result<String>
Get Redis URL from infrastructure configuration
Sourcepub async fn load_node_config<T>(&self, node_name: &str) -> Result<T>where
T: DeserializeOwned + Default,
pub async fn load_node_config<T>(&self, node_name: &str) -> Result<T>where
T: DeserializeOwned + Default,
Load node configuration with environment-aware file-level fallback
This method implements the V2 configuration system with:
- Environment-specific configs (dev/staging/production)
- File-level fallback (no key-by-key merging)
- Automatic path resolution
Fallback Priority:
configs/{env}/nodes/{node-name}/config.json(environment-specific)configs/common/nodes/{node-name}/config.json(common fallback)T::default()(code default)
Environment Detection:
- Uses
MECHA10_ENVIRONMENTenv var (default: “dev”) - Supported values: “dev”, “staging”, “production”, or custom
§Type Parameters
T- Configuration type that implementsDeserializeOwned+Default
§Arguments
node_name- Name of the node (e.g., “simulation-bridge”, “camera-streamer”)
§Returns
The loaded configuration of type T, using the first available source
in the fallback chain.
§Example
use mecha10::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
struct SimBridgeConfig {
camera_width: u32,
camera_height: u32,
camera_fps: u32,
}
// Loads from configs/{env}/nodes/simulation-bridge/config.json
// Falls back to configs/common/nodes/simulation-bridge/config.json
// Falls back to SimBridgeConfig::default()
let config: SimBridgeConfig = ctx.load_node_config("simulation-bridge").await?;Sourcepub async fn has_control_plane(&self) -> bool
pub async fn has_control_plane(&self) -> bool
Check if control plane Redis connection is available
Sourcepub fn get_control_plane_redis_url() -> Result<Option<String>>
pub fn get_control_plane_redis_url() -> Result<Option<String>>
Get control plane Redis URL from infrastructure configuration
Sourcepub async fn subscribe<T>(&self, topic: Topic<T>) -> Result<Receiver<T>>
pub async fn subscribe<T>(&self, topic: Topic<T>) -> Result<Receiver<T>>
Subscribe to a topic with type-safe message handling
§Arguments
topic- Type-safe topic to subscribe to
§Returns
A receiver that will yield messages of type T
§Example
use mecha10::prelude::*;
use mecha10::topics::sensor;
// Type is inferred as Receiver<Image>
let mut images = ctx.subscribe(sensor::CAMERA_RGB).await?;
while let Some(image) = images.recv().await {
println!("Image: {}x{}", image.width, image.height);
}Sourcepub async fn publish_to<T>(&self, topic: Topic<T>, message: &T) -> Result<()>
pub async fn publish_to<T>(&self, topic: Topic<T>, message: &T) -> Result<()>
Publish a message to a specific topic
§Arguments
topic- Type-safe topic to publish tomessage- Message to publish (type checked against topic)
§Example
use mecha10::prelude::*;
use mecha10::topics::sensor;
use mecha10::messages::Image;
let image = Image {
timestamp: now_micros(),
width: 640,
height: 480,
encoding: "rgb8".to_string(),
data: vec![],
};
// Type checked: image must be of type Image
ctx.publish_to(sensor::CAMERA_RGB, &image).await?;Sourcepub async fn publish_to_path<T>(
&self,
topic_path: &str,
message: &T,
) -> Result<()>
pub async fn publish_to_path<T>( &self, topic_path: &str, message: &T, ) -> Result<()>
Publish a message to a dynamic topic path (for runtime-generated topics like camera streams)
This is useful when the topic path is determined at runtime and cannot be a &'static str.
§Arguments
topic_path- The topic path as a String (e.g., “robot/sensors/camera/front/compressed”)message- The message to publish
Sourcepub async fn publish_to_scoped<T>(
&self,
topic: Topic<T>,
message: &T,
) -> Result<()>
pub async fn publish_to_scoped<T>( &self, topic: Topic<T>, message: &T, ) -> Result<()>
Publish a message to an instance-scoped topic
This automatically appends the context’s instance name to the topic path.
If no instance is set, this behaves like publish_to().
§Arguments
topic- Type-safe topic to publish tomessage- Message to publish (type checked against topic)
§Example
use mecha10::prelude::*;
use mecha10::topics::sensor;
use mecha10::messages::Image;
let ctx = Context::new("camera_fake").await?.with_instance("left");
let image = Image {
timestamp: now_micros(),
width: 640,
height: 480,
encoding: "rgb8".to_string(),
data: vec![],
};
// Publishes to "/sensor/camera/rgb/left"
ctx.publish_to_scoped(sensor::CAMERA_RGB, &image).await?;Sourcepub async fn publish_to_instance<T>(
&self,
topic: Topic<T>,
instance: &str,
message: &T,
) -> Result<()>
pub async fn publish_to_instance<T>( &self, topic: Topic<T>, instance: &str, message: &T, ) -> Result<()>
Publish a message to a topic with an explicit instance suffix
This allows publishing to a specific instance’s topic regardless of the context’s own instance name.
§Arguments
topic- Type-safe topic to publish toinstance- Instance name to append to topic pathmessage- Message to publish (type checked against topic)
§Example
use mecha10::prelude::*;
use mecha10::topics::actuator;
let cmd = MotorCommand { velocity: 1.0, torque: 0.0 };
// Send to specific motor instances
ctx.publish_to_instance(actuator::MOTOR_CMD, "front_left", &cmd).await?;
ctx.publish_to_instance(actuator::MOTOR_CMD, "front_right", &cmd).await?;Sourcepub async fn subscribe_scoped<T>(
&self,
topic: Topic<T>,
instance: &str,
) -> Result<Receiver<T>>
pub async fn subscribe_scoped<T>( &self, topic: Topic<T>, instance: &str, ) -> Result<Receiver<T>>
Subscribe to an instance-scoped topic
This automatically appends the context’s instance name to the topic path.
If no instance is set, this behaves like subscribe().
§Example
use mecha10::prelude::*;
use mecha10::topics::sensor;
let ctx = Context::new("vision_node").await?;
// Subscribe to left camera (topic: "/sensor/camera/rgb/left")
let mut left_images = ctx.subscribe_scoped(sensor::CAMERA_RGB, "left").await?;
// Subscribe to right camera (topic: "/sensor/camera/rgb/right")
let mut right_images = ctx.subscribe_scoped(sensor::CAMERA_RGB, "right").await?;Sourcepub async fn subscribe_raw<T>(&self, topic_path: &str) -> Result<Receiver<T>>
pub async fn subscribe_raw<T>(&self, topic_path: &str) -> Result<Receiver<T>>
Subscribe to a topic using a raw string path (for RPC and advanced use cases)
§Arguments
topic_path- Raw topic path string
§Returns
A receiver that will yield messages of type T
§Note
This is a low-level method. Prefer using subscribe() with type-safe topics
for normal use cases. This method is primarily for RPC and dynamic topic handling.
Sourcepub async fn discover_topics(&self, pattern: &str) -> Result<Vec<String>>
pub async fn discover_topics(&self, pattern: &str) -> Result<Vec<String>>
Discover topics matching a glob pattern
Queries Redis for all topics matching the given pattern without subscribing. Useful for inspecting available topics before subscribing.
§Pattern Syntax
*matches any sequence of characters within a path segment**matches any sequence of path segments{a,b}matches either a or b (future enhancement)
§Arguments
pattern- Glob pattern to match topics against
§Returns
A vector of topic paths that match the pattern
§Example
use mecha10::prelude::*;
// Discover all camera topics
let topics = ctx.discover_topics("/sensor/camera/*").await?;
println!("Found {} camera topics: {:?}", topics.len(), topics);Sourcepub async fn subscribe_aggregated<T>(
&self,
pattern: &str,
) -> Result<AggregatedReceiver<T>>
pub async fn subscribe_aggregated<T>( &self, pattern: &str, ) -> Result<AggregatedReceiver<T>>
Subscribe to multiple topics matching a glob pattern
Returns an aggregated receiver that multiplexes all matching topics into a single stream. Each message is tagged with its source topic path.
§Pattern Syntax
*matches any sequence of characters within a path segment**matches any sequence of path segments{a,b}matches either a or b (future enhancement)
§Arguments
pattern- Glob pattern to match topics against
§Returns
An AggregatedReceiver<T> that yields (topic_path, message) tuples
§Examples
use mecha10::prelude::*;
// Subscribe to all cameras with one call
let mut cameras = ctx.subscribe_aggregated::<ImageMessage>("/sensor/camera/*").await?;
while let Some((topic, image)) = cameras.recv().await {
let camera_name = topic.rsplit('/').next().unwrap_or("unknown");
println!("Camera {}: {}x{}", camera_name, image.width, image.height);
}Sourcepub async fn publish_raw<T>(&self, topic_path: &str, message: &T) -> Result<()>
pub async fn publish_raw<T>(&self, topic_path: &str, message: &T) -> Result<()>
Publish a message to a topic using a raw string path (for RPC and advanced use cases)
§Arguments
topic_path- Raw topic path stringmessage- Message to publish
§Note
This is a low-level method. Prefer using publish_to() with type-safe topics
for normal use cases. This method is primarily for RPC and dynamic topic handling.
Sourcepub async fn is_shutdown(&self) -> bool
pub async fn is_shutdown(&self) -> bool
Check if shutdown has been requested
Sourcepub async fn wait_for_shutdown(&self)
pub async fn wait_for_shutdown(&self)
Wait for shutdown signal
Sourcepub fn logging_span(&self) -> Span
pub fn logging_span(&self) -> Span
Enter a logging span with this node’s context
This returns a guard that, when entered, adds the node_id to all log messages. The span is automatically exited when the guard is dropped.
§Example
use mecha10::prelude::*;
let _guard = ctx.logging_span().entered();
info!("This message includes node_id automatically");
debug!("So does this one");Sourcepub async fn subscribe_all_cameras(&self) -> Result<AggregatedReceiver<Image>>
pub async fn subscribe_all_cameras(&self) -> Result<AggregatedReceiver<Image>>
Subscribe to all camera topics
Convenience method for subscribe_aggregated::<Image>("/sensor/camera/*")
§Example
use mecha10::prelude::*;
let mut cameras = ctx.subscribe_all_cameras().await?;
while let Some((topic, image)) = cameras.recv().await {
let camera_name = topic.rsplit('/').next().unwrap_or("unknown");
println!("Camera {}: {}x{}", camera_name, image.width, image.height);
}Sourcepub async fn discover_all_sensors(&self) -> Result<Vec<String>>
pub async fn discover_all_sensors(&self) -> Result<Vec<String>>
Subscribe to all sensor topics
Subscribes to all sensor data including cameras, LiDAR, IMU, odometry, etc.
§Example
use mecha10::prelude::*;
// Subscribe to all sensors (returns untyped messages)
let topics = ctx.discover_topics("/sensor/**").await?;
println!("Found {} sensor topics", topics.len());Sourcepub async fn subscribe_all_lidars(
&self,
) -> Result<AggregatedReceiver<LaserScan>>
pub async fn subscribe_all_lidars( &self, ) -> Result<AggregatedReceiver<LaserScan>>
Subscribe to all LiDAR topics
Convenience method for subscribe_aggregated::<LaserScan>("/sensor/lidar/*")
Sourcepub async fn subscribe_all_imus(&self) -> Result<AggregatedReceiver<IMU>>
pub async fn subscribe_all_imus(&self) -> Result<AggregatedReceiver<IMU>>
Subscribe to all IMU topics
Convenience method for subscribe_aggregated::<IMU>("/sensor/imu/*")
Sourcepub async fn subscribe_all_motors(
&self,
) -> Result<AggregatedReceiver<MotorStatus>>
pub async fn subscribe_all_motors( &self, ) -> Result<AggregatedReceiver<MotorStatus>>
Subscribe to all motor topics
Convenience method for subscribe_aggregated::<MotorStatus>("/actuator/motor/*")
Sourcepub async fn subscribe_pattern<T>(
&self,
topic: Topic<T>,
pattern: &str,
) -> Result<AggregatedReceiver<T>>
pub async fn subscribe_pattern<T>( &self, topic: Topic<T>, pattern: &str, ) -> Result<AggregatedReceiver<T>>
Subscribe to a topic pattern with wildcard
Generic helper for subscribing to multiple topics matching a pattern.
§Example
use mecha10::prelude::*;
use mecha10::topics::sensor;
// Subscribe to all instances of a specific topic type
let mut cameras = ctx.subscribe_pattern(sensor::CAMERA_RGB, "*").await?;Sourcepub async fn state_manager(&self) -> Result<Arc<ConcreteStateManager>>
pub async fn state_manager(&self) -> Result<Arc<ConcreteStateManager>>
Get or create a state manager for this node
The state manager provides persistent storage for node state across restarts.
By default, it uses filesystem storage in ./state/ directory.
§Example
use mecha10::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
struct MyState {
counter: u64,
position: (f64, f64),
}
let state_mgr = ctx.state_manager().await?;
// Load previous state
let mut state = state_mgr
.load::<MyState>("my_node")
.await?
.unwrap_or(MyState {
counter: 0,
position: (0.0, 0.0),
});
// Update state
state.counter += 1;
// Save state
state_mgr.save("my_node", &state).await?;Sourcepub async fn set_state_manager(&self, manager: Arc<ConcreteStateManager>)
pub async fn set_state_manager(&self, manager: Arc<ConcreteStateManager>)
Set a custom state manager for this context
This allows using alternative backends (Redis, PostgreSQL, etc.) or custom implementations.
§Example
use mecha10::prelude::*;
use std::sync::Arc;
// Use in-memory state manager for testing
let mem_mgr = Arc::new(MemoryStateManager::new());
ctx.set_state_manager(mem_mgr).await;Sourcepub async fn list_sensor_topics(&self) -> Result<Vec<String>>
pub async fn list_sensor_topics(&self) -> Result<Vec<String>>
List all sensor topics currently active in the system
Returns all topics under /sensor/* including cameras, LiDAR, IMU, GPS, etc.
§Example
use mecha10::prelude::*;
let sensors = ctx.list_sensor_topics().await?;
println!("Available sensors:");
for topic in sensors {
println!(" - {}", topic);
}Sourcepub async fn list_actuator_topics(&self) -> Result<Vec<String>>
pub async fn list_actuator_topics(&self) -> Result<Vec<String>>
List all actuator topics currently active in the system
Returns all topics under /actuator/* including motors, servos, grippers, etc.
§Example
use mecha10::prelude::*;
let actuators = ctx.list_actuator_topics().await?;
println!("Available actuators:");
for topic in actuators {
println!(" - {}", topic);
}Sourcepub async fn list_all_topics(&self) -> Result<Vec<String>>
pub async fn list_all_topics(&self) -> Result<Vec<String>>
List all topics in the system
Returns all active topics regardless of category.
§Example
use mecha10::prelude::*;
let all_topics = ctx.list_all_topics().await?;
println!("All active topics ({} total):", all_topics.len());
for topic in all_topics {
println!(" - {}", topic);
}Sourcepub async fn list_camera_topics(&self) -> Result<Vec<String>>
pub async fn list_camera_topics(&self) -> Result<Vec<String>>
List all camera topics
Returns all topics under /sensor/camera/*.
§Example
use mecha10::prelude::*;
let cameras = ctx.list_camera_topics().await?;
println!("Available cameras:");
for topic in cameras {
println!(" - {}", topic);
}Sourcepub async fn list_lidar_topics(&self) -> Result<Vec<String>>
pub async fn list_lidar_topics(&self) -> Result<Vec<String>>
List all LiDAR topics
Returns all topics under /sensor/lidar/*.
Sourcepub async fn list_imu_topics(&self) -> Result<Vec<String>>
pub async fn list_imu_topics(&self) -> Result<Vec<String>>
List all IMU topics
Returns all topics under /sensor/imu/*.
Sourcepub async fn list_motor_topics(&self) -> Result<Vec<String>>
pub async fn list_motor_topics(&self) -> Result<Vec<String>>
List all motor topics
Returns all topics under /actuator/motor/*.
Sourcepub async fn print_topic_summary(&self) -> Result<()>
pub async fn print_topic_summary(&self) -> Result<()>
Print a formatted summary of all active topics
Useful for debugging and introspection. Groups topics by category and displays them in a human-readable format.
§Example
use mecha10::prelude::*;
ctx.print_topic_summary().await?;
// Output:
// === Active Topics ===
// Sensors (3):
// - /sensor/camera/front
// - /sensor/lidar/main
// - /sensor/imu/base
// Actuators (2):
// - /actuator/motor/left
// - /actuator/motor/right
// =====================Trait Implementations§
Source§impl AuthExt for Context
impl AuthExt for Context
Source§async fn get_policy(&self, role: &str) -> Result<Option<Policy>>
async fn get_policy(&self, role: &str) -> Result<Option<Policy>>
Source§async fn assign_role(&self, node_id: &str, role: &str) -> Result<()>
async fn assign_role(&self, node_id: &str, role: &str) -> Result<()>
Source§async fn get_role(&self, node_id: &str) -> Result<Option<String>>
async fn get_role(&self, node_id: &str) -> Result<Option<String>>
Source§async fn check_permission(
&self,
node_id: &str,
permission: Permission,
topic: &str,
) -> Result<bool>
async fn check_permission( &self, node_id: &str, permission: Permission, topic: &str, ) -> Result<bool>
Source§impl ContextPublishExt for Context
impl ContextPublishExt for Context
Source§fn publish_with<'a, 'b, T>(
&'a self,
topic: Topic<T>,
message: &'b T,
) -> PublishBuilder<'a, 'b, T>
fn publish_with<'a, 'b, T>( &'a self, topic: Topic<T>, message: &'b T, ) -> PublishBuilder<'a, 'b, T>
Source§impl DiscoveryExt for Context
impl DiscoveryExt for Context
Source§async fn register(&self, metadata: NodeMetadata) -> Result<()>
async fn register(&self, metadata: NodeMetadata) -> Result<()>
Source§async fn unregister(&self) -> Result<()>
async fn unregister(&self) -> Result<()>
Source§async fn discover_all(&self) -> Result<Vec<NodeMetadata>>
async fn discover_all(&self) -> Result<Vec<NodeMetadata>>
Source§async fn discover_by_type(&self, node_type: &str) -> Result<Vec<NodeMetadata>>
async fn discover_by_type(&self, node_type: &str) -> Result<Vec<NodeMetadata>>
Source§async fn discover_publishers(&self, topic: &str) -> Result<Vec<NodeMetadata>>
async fn discover_publishers(&self, topic: &str) -> Result<Vec<NodeMetadata>>
Source§async fn discover_subscribers(&self, topic: &str) -> Result<Vec<NodeMetadata>>
async fn discover_subscribers(&self, topic: &str) -> Result<Vec<NodeMetadata>>
Source§impl HealthReportingExt for Context
impl HealthReportingExt for Context
Source§impl RpcBreakerExt for Context
impl RpcBreakerExt for Context
Source§fn request_with_breaker<Req, Resp>(
&self,
topic: &str,
request: &Req,
config: CircuitBreakerConfig,
) -> BreakerRequestBuilder<'_, Req, Resp>
fn request_with_breaker<Req, Resp>( &self, topic: &str, request: &Req, config: CircuitBreakerConfig, ) -> BreakerRequestBuilder<'_, Req, Resp>
Source§impl RpcExt for Context
impl RpcExt for Context
Source§fn request<Req, Resp>(
&self,
topic: &str,
request: &Req,
) -> RequestBuilder<'_, Req, Resp>
fn request<Req, Resp>( &self, topic: &str, request: &Req, ) -> RequestBuilder<'_, Req, Resp>
Source§async fn respond<Req, Resp, F, Fut>(
&self,
topic: &str,
handler: F,
) -> Result<()>
async fn respond<Req, Resp, F, Fut>( &self, topic: &str, handler: F, ) -> Result<()>
Source§impl SchemaRegistryExt for Context
impl SchemaRegistryExt for Context
Source§async fn register_schema(&self, schema: &MessageSchema) -> Result<()>
async fn register_schema(&self, schema: &MessageSchema) -> Result<()>
Source§async fn get_schema(
&self,
name: &str,
version: u32,
) -> Result<Option<MessageSchema>>
async fn get_schema( &self, name: &str, version: u32, ) -> Result<Option<MessageSchema>>
Source§async fn get_latest_schema(&self, name: &str) -> Result<Option<MessageSchema>>
async fn get_latest_schema(&self, name: &str) -> Result<Option<MessageSchema>>
Source§async fn list_schemas(&self) -> Result<Vec<MessageSchema>>
async fn list_schemas(&self) -> Result<Vec<MessageSchema>>
Source§async fn get_schema_versions(&self, name: &str) -> Result<Vec<MessageSchema>>
async fn get_schema_versions(&self, name: &str) -> Result<Vec<MessageSchema>>
Source§impl SchemaVersioningExt for Context
impl SchemaVersioningExt for Context
Source§async fn check_compatibility(
&self,
name: &str,
old_version: u32,
new_version: u32,
mode: CompatibilityMode,
) -> Result<CompatibilityCheck>
async fn check_compatibility( &self, name: &str, old_version: u32, new_version: u32, mode: CompatibilityMode, ) -> Result<CompatibilityCheck>
Source§async fn register_versioned_schema(
&self,
schema: &MessageSchema,
mode: CompatibilityMode,
) -> Result<CompatibilityCheck>
async fn register_versioned_schema( &self, schema: &MessageSchema, mode: CompatibilityMode, ) -> Result<CompatibilityCheck>
Source§async fn get_version_info(
&self,
name: &str,
) -> Result<Option<MessageVersionInfo>>
async fn get_version_info( &self, name: &str, ) -> Result<Option<MessageVersionInfo>>
Source§impl StreamingRpcExt for Context
impl StreamingRpcExt for Context
Source§async fn stream_request<Req, Resp>(
&self,
topic: &str,
request: &Req,
) -> Result<StreamReceiver<Resp>>
async fn stream_request<Req, Resp>( &self, topic: &str, request: &Req, ) -> Result<StreamReceiver<Resp>>
Source§async fn stream_respond<Req, Resp, F, Fut>(
&self,
topic: &str,
handler: F,
) -> Result<()>
async fn stream_respond<Req, Resp, F, Fut>( &self, topic: &str, handler: F, ) -> Result<()>
Source§async fn bidirectional_stream<T>(
&self,
topic: &str,
) -> Result<(StreamSender<T>, StreamReceiver<T>)>
async fn bidirectional_stream<T>( &self, topic: &str, ) -> Result<(StreamSender<T>, StreamReceiver<T>)>
Source§impl TracingExt for Context
impl TracingExt for Context
Source§async fn publish_traced<T: Message + Serialize + Clone + 'static>(
&self,
topic: &str,
message: &T,
) -> Result<()>
async fn publish_traced<T: Message + Serialize + Clone + 'static>( &self, topic: &str, message: &T, ) -> Result<()>
Source§async fn publish_with_context<T: Message + Serialize + Clone + 'static>(
&self,
topic: &str,
message: &T,
trace_context: TraceContext,
) -> Result<()>
async fn publish_with_context<T: Message + Serialize + Clone + 'static>( &self, topic: &str, message: &T, trace_context: TraceContext, ) -> Result<()>
Source§async fn subscribe_traced<T: Message + DeserializeOwned + Send + 'static>(
&self,
topic: &str,
) -> Result<Receiver<TracedMessage<T>>>
async fn subscribe_traced<T: Message + DeserializeOwned + Send + 'static>( &self, topic: &str, ) -> Result<Receiver<TracedMessage<T>>>
Source§fn current_trace_context(&self) -> Option<TraceContext>
fn current_trace_context(&self) -> Option<TraceContext>
Source§fn extract_trace_context(
&self,
metadata: &HashMap<String, String>,
) -> Option<TraceContext>
fn extract_trace_context( &self, metadata: &HashMap<String, String>, ) -> Option<TraceContext>
Source§fn inject_trace_context(
&self,
metadata: &mut HashMap<String, String>,
ctx: &TraceContext,
)
fn inject_trace_context( &self, metadata: &mut HashMap<String, String>, ctx: &TraceContext, )
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more