(bytes: &mut Vec<u8>, value: &[u8])
| 357 | } |
| 358 | |
| 359 | fn encode_len_prefixed(bytes: &mut Vec<u8>, value: &[u8]) -> PristineResult<()> { |
| 360 | if value.len() > u16::MAX as usize { |
| 361 | return Err(PristineError::Serialization { |
| 362 | message: format!( |
| 363 | "ref mapping field of {} bytes exceeds the u16-length encoding limit", |
| 364 | value.len() |
| 365 | ), |
| 366 | }); |
| 367 | } |
| 368 | bytes.extend_from_slice(&(value.len() as u16).to_le_bytes()); |
| 369 | bytes.extend_from_slice(value); |
| 370 | Ok(()) |
| 371 | } |
| 372 | |
| 373 | fn encode_option_ref(bytes: &mut Vec<u8>, value: Option<&str>) -> PristineResult<()> { |
| 374 | match value { |
no test coverage detected