Function rust_multicodec::remove_prefix
[−]
[src]
pub fn remove_prefix(data: &[u8]) -> Result<Vec<u8>, &'static str>
Removes the codec prefix and returns the raw data.
Arguments
data
- the data with prefix
Example
extern crate rust_multicodec; extern crate hex_slice; use hex_slice::AsHex; use std::process; fn main(){ let data="Live long and prosper"; let prefixed=rust_multicodec::add_prefix("base1",data.as_bytes()).unwrap(); let raw_data=rust_multicodec::remove_prefix(prefixed.as_slice()).unwrap(); println!("Original data was {:?}", String::from_utf8(raw_data).unwrap()) // it will print return "Original data was Live long and prosper" }