ollie 0.2.11

An abstraction layer on top of lapin, to align with traditional HTTP API routing.
Documentation
use std::str::FromStr;

impl FromStr for Exchange {
    type Err = String;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        let parts: Vec<&str> = s.split(':').collect();
        if parts.len() != 2 {
            return Err("Exchange must be in the format name:routing_key".to_string());
        }
        Ok(Self {
            name: parts[0].to_string(),
            routing_key: parts[1].to_string(),
        })
    }
}

#[derive(Debug, Clone)]
pub struct Exchange {
    pub name: String,
    pub routing_key: String,
}