Coverage Report

Created: 2025-10-10 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/rmp-0.8.14/src/encode/dec.rs
Line
Count
Source
1
use super::{write_marker, RmpWrite};
2
use crate::encode::ValueWriteError;
3
use crate::Marker;
4
5
/// Encodes and attempts to write an `f32` value as a 5-byte sequence into the given write.
6
///
7
/// The first byte becomes the `f32` marker and the others will represent the data itself.
8
///
9
/// # Errors
10
///
11
/// This function will return `ValueWriteError` on any I/O error occurred while writing either the
12
/// marker or the data.
13
0
pub fn write_f32<W: RmpWrite>(wr: &mut W, val: f32) -> Result<(), ValueWriteError<W::Error>> {
14
0
    write_marker(wr, Marker::F32)?;
15
0
    wr.write_data_f32(val)?;
16
0
    Ok(())
17
0
}
18
19
/// Encodes and attempts to write an `f64` value as a 9-byte sequence into the given write.
20
///
21
/// The first byte becomes the `f64` marker and the others will represent the data itself.
22
///
23
/// # Errors
24
///
25
/// This function will return `ValueWriteError` on any I/O error occurred while writing either the
26
/// marker or the data.
27
0
pub fn write_f64<W: RmpWrite>(wr: &mut W, val: f64) -> Result<(), ValueWriteError<W::Error>> {
28
0
    write_marker(wr, Marker::F64)?;
29
0
    wr.write_data_f64(val)?;
30
0
    Ok(())
31
0
}