Skip to main content

encode

Function encode 

Source
pub fn encode(
    verb: &str,
    params: &[(&str, &str)],
    body: &[u8],
    limit: usize,
    chunk: &str,
) -> Vec<u8> ⓘ
Expand description

Encodes one message of verb with params and an already serialized body, chunked under limit with chunk id chunk when it is longer.

§Example

let out = tern_sdk::wire::encode("o", &[], br#"{"id":"s1"}"#, 65536, "1");
assert_eq!(out, b"\x1b_tsp;o;{\"id\":\"s1\"}\x1b\\");