mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-20 08:16:31 +00:00
Preserve argument names
This commit is contained in:
@ -46,6 +46,15 @@ impl<'src> Decode<'src> for &'src str {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'src> Decode<'src> for String {
|
||||
fn decode(data: &mut &'src [u8]) -> String {
|
||||
let n = u32::decode(data);
|
||||
let (a, b) = data.split_at(n as usize);
|
||||
*data = b;
|
||||
String::from_utf8(a.to_vec()).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'src, T: Decode<'src>> Decode<'src> for Vec<T> {
|
||||
fn decode(data: &mut &'src [u8]) -> Self {
|
||||
let n = u32::decode(data);
|
||||
|
Reference in New Issue
Block a user