(context: &mut ReadContext)
| 42 | |
| 43 | #[inline(always)] |
| 44 | fn fory_read_data(context: &mut ReadContext) -> Result<Self, Error> { |
| 45 | // xlang mode: read encoding header and decode accordingly |
| 46 | let bitor = context.reader.read_var_u36_small()?; |
| 47 | let len = bitor >> 2; |
| 48 | let encoding = bitor & 0b11; |
| 49 | let s = match encoding { |
| 50 | 0 => context.reader.read_latin1_string(len as usize), |
| 51 | 1 => context.reader.read_utf16_string(len as usize), |
| 52 | 2 => { |
| 53 | let len = len as usize; |
| 54 | if context.is_check_string_read() { |
| 55 | context.reader.read_utf8_string(len) |
| 56 | } else { |
| 57 | context.reader.read_utf8_string_unchecked(len) |
| 58 | } |
| 59 | } |
| 60 | _ => { |
| 61 | return Err(Error::encoding_error(format!( |
| 62 | "wrong encoding value: {}", |
| 63 | encoding |
| 64 | ))) |
| 65 | } |
| 66 | }?; |
| 67 | Ok(s) |
| 68 | } |
| 69 | #[inline] |
| 70 | fn fory_read_data_as_send_sync_any( |
| 71 | context: &mut ReadContext, |
nothing calls this directly
no test coverage detected