channel-server 0.1.0

crate request/response topic-publish/subject by channels in multithreads
Documentation
1
2
3
4
5
6
7
8
use crate::{Body, ChannelError, FromRequest, Request};

impl<'a> FromRequest<'a> for String {
    fn from_request(_req: &'a Request, body: &mut Body) -> Result<Self, ChannelError> {
        let data = body.take()?;
        Ok(String::from_utf8(data.to_vec()).map_err(ChannelError::NotUtf8)?)
    }
}