36 releases (14 breaking)
Uses new Rust 2024
| new 0.16.0 | Jun 11, 2026 |
|---|---|
| 0.14.0 | Jun 7, 2026 |
| 0.5.1 | Mar 29, 2026 |
#2300 in Network programming
632 downloads per month
Used in 36 crates
(8 directly)
375KB
9K
SLoC
camel-endpoint
Endpoint parsing and URI handling for rust-camel
Overview
camel-endpoint provides URI parsing and endpoint abstraction for the rust-camel framework. It handles the parsing of endpoint URIs in the format scheme:path?param1=value1¶m2=value2 that Camel is known for.
This crate is used internally by components to parse their configuration from URI strings.
Features
- URI parsing with scheme, path, and query parameters
UriComponentsstruct for easy access to URI partsUriConfigderive macro for declarative, typed component configuration- Error handling for malformed URIs
Installation
Add to your Cargo.toml:
[dependencies]
camel-endpoint = "*"
Usage
use camel_endpoint::{parse_uri, UriComponents};
// Parse a Camel-style URI
let uri = "timer:tick?period=1000&delay=500";
let components = parse_uri(uri).unwrap();
assert_eq!(components.scheme, "timer");
assert_eq!(components.path, "tick");
assert_eq!(components.params.get("period"), Some(&"1000".to_string()));
assert_eq!(components.params.get("delay"), Some(&"500".to_string()));
Declarative Config with UriConfig
The #[derive(UriConfig)] macro generates typed config structs from URI query parameters:
use camel_endpoint::UriConfig;
#[derive(UriConfig)]
pub struct TimerConfig {
pub period: u64, // ?period=1000
#[uri(default = "*")]
pub delay: u64, // ?delay=500 (optional, default 0)
#[uri(rename = "repeatCount")]
pub repeat_count: Option<u64>,
}
// Parse directly from a URI
let config = TimerConfig::from_uri("timer:tick?period=1000&delay=200").unwrap();
assert_eq!(config.period, 1000);
assert_eq!(config.delay, 200);
URI Format
Endpoints follow the standard Camel URI format:
scheme:path[?param1=value1¶m2=value2]
scheme: The component name (e.g.,timer,file,http)path: Component-specific path (e.g., timer name, file directory)params: Optional query parameters for configuration
Documentation
License
Apache-2.0
Contributing
Contributions are welcome! Please see the main repository for details.
Dependencies
~9–12MB
~205K SLoC