pub fn encode_float(value: f32) -> Vec<u8> ⓘExpand description
Encodes a single-precision floating-point number (f32) into its binary representation.
The encoding process converts the f32 value into its little-endian byte representation
and appends the bytes to a buffer.
§Arguments
value- Thef32value to be encoded.
§Returns
A Vec<u8> containing the binary representation of the input f32 value.
§Example
use rustwire::encode_float;
let value: f32 = 3.14;
let encoded = encode_float(value);
assert_eq!(encoded, vec![0xC3, 0xF5, 0x48, 0x40]);