Write a [DataValue] to a slice in native-endian byte order. # Panics: Panics if the slice does not have enough space to accommodate the [DataValue]
(&self, dst: &mut [u8])
| 156 | /// |
| 157 | /// Panics if the slice does not have enough space to accommodate the [DataValue] |
| 158 | pub fn write_to_slice_ne(&self, dst: &mut [u8]) { |
| 159 | match self { |
| 160 | DataValue::I8(i) => dst[..1].copy_from_slice(&i.to_ne_bytes()[..]), |
| 161 | DataValue::I16(i) => dst[..2].copy_from_slice(&i.to_ne_bytes()[..]), |
| 162 | DataValue::I32(i) => dst[..4].copy_from_slice(&i.to_ne_bytes()[..]), |
| 163 | DataValue::I64(i) => dst[..8].copy_from_slice(&i.to_ne_bytes()[..]), |
| 164 | DataValue::I128(i) => dst[..16].copy_from_slice(&i.to_ne_bytes()[..]), |
| 165 | DataValue::F16(f) => dst[..2].copy_from_slice(&f.bits().to_ne_bytes()[..]), |
| 166 | DataValue::F32(f) => dst[..4].copy_from_slice(&f.bits().to_ne_bytes()[..]), |
| 167 | DataValue::F64(f) => dst[..8].copy_from_slice(&f.bits().to_ne_bytes()[..]), |
| 168 | DataValue::F128(f) => dst[..16].copy_from_slice(&f.bits().to_ne_bytes()[..]), |
| 169 | DataValue::V128(v) => dst[..16].copy_from_slice(&v[..]), |
| 170 | DataValue::V64(v) => dst[..8].copy_from_slice(&v[..]), |
| 171 | DataValue::V32(v) => dst[..4].copy_from_slice(&v[..]), |
| 172 | DataValue::V16(v) => dst[..2].copy_from_slice(&v[..]), |
| 173 | }; |
| 174 | } |
| 175 | |
| 176 | /// Write a [DataValue] to a slice in big-endian byte order. |
| 177 | /// |
no test coverage detected