krpc-common 0.2.0

RPC framework for service registration and discovery through API exposure, compatible with Dubbo3 protocol, intertunable with Java projects
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use percent_encoding::{self, percent_decode_str, percent_encode, AsciiSet, CONTROLS};
const FRAGMENT: &AsciiSet = &CONTROLS
    .add(b':')
    .add(b'/')
    .add(b'&')
    .add(b'?')
    .add(b'=')
    .add(b',');

pub fn decode_url(url: &str) -> Result<String, String> {
    Ok(percent_decode_str(url)
        .decode_utf8()
        .map_err(|e|e.to_string())?.to_string())
}
pub fn encode_url(url: &str) -> String {
    percent_encode(url.as_bytes(), FRAGMENT).to_string()
}