pub mod aligned;
mod de;
mod error;
mod ext;
pub mod fast;
pub mod field;
mod header;
mod json;
#[cfg(feature = "mat")]
pub mod mat;
#[cfg(feature = "mat")]
mod raw;
mod ser;
mod serde_arrays;
mod size;
mod streaming_de;
mod streaming_ser;
mod value;
pub use crate::aligned::{
aligned_typed_slice_size, read_aligned_typed_slice, read_aligned_typed_slice_ref,
to_vec_aligned_typed_slice, write_aligned_typed_slice, write_aligned_typed_slice_at,
};
pub use crate::de::{Deserializer, from_slice, validate_slice};
pub use crate::error::{Error, Result};
pub use crate::ext::{
Complex, ComplexSlice, DecodedMatrix, Matrix, MatrixDecodeMode, MatrixLayout, MatrixOwned,
RawMatrix, TypedSlice, complex, decode_matrix_slice,
};
pub use crate::fast::{
BeveTypedSlice, complex_slice_size, read_complex_slice, read_complex_slice_from_reader,
read_typed_slice, read_typed_slice_from_reader, to_vec_bool_slice, to_vec_complex_slice,
to_vec_str_slice, to_vec_string_slice, to_vec_typed_slice, to_writer_complex_slice,
to_writer_typed_slice, typed_slice_size, write_bool_slice, write_complex_slice,
write_str_slice, write_string_slice, write_typed_slice,
};
pub use crate::field::{from_field, from_field_slice, skip_value};
pub use crate::json::{
beve_slice_to_json, beve_slice_to_json_string, json_slice_to_beve, json_str_to_beve,
};
#[cfg(feature = "mat")]
pub use crate::mat::{
Compression, InvalidNamePolicy, LibVer, MatV73Options, NullPolicy, OneDimensionalMode,
RootBinding, RowMajorPolicy, UnsupportedPolicy, beve_file_to_mat_v73_file,
beve_slice_to_mat_v73_bytes, beve_slice_to_mat_v73_file, beve_slice_to_mat_v73_writer,
};
pub use crate::ser::{Serializer, to_vec, to_vec_into};
pub use crate::serde_arrays::{complex_array, typed};
pub use crate::streaming_de::{StreamingDeserializer, from_reader_streaming};
pub use crate::streaming_ser::{StreamingSerializer, serialized_size, to_writer_streaming};
pub use crate::value::{
BigInt, BigIntKey, Key, Number, Object, Value, ValueError, from_value, from_value_ref,
};
pub mod util {
pub use crate::ext::MatrixLayout;
}
pub const DATA_DELIMITER: u8 = crate::header::make_extension_header(crate::header::EXT_DELIMITER);
pub fn write_delimiter<W: Write>(mut writer: W) -> Result<()> {
writer
.write_all(&[DATA_DELIMITER])
.map_err(|e| Error::MessageOwned(e.to_string()))
}
use std::io::{Read, Write};
pub fn to_writer<W: Write, T: serde::Serialize>(mut writer: W, value: &T) -> Result<()> {
let bytes = to_vec(value)?;
writer
.write_all(&bytes)
.map_err(|e| Error::MessageOwned(e.to_string()))
}
pub fn from_reader<R: Read, T: serde::de::DeserializeOwned>(mut reader: R) -> Result<T> {
let mut buf = Vec::new();
reader
.read_to_end(&mut buf)
.map_err(|e| Error::MessageOwned(e.to_string()))?;
from_slice(&buf)
}
pub fn validate_reader<R: Read>(mut reader: R) -> Result<()> {
let mut buf = Vec::new();
reader
.read_to_end(&mut buf)
.map_err(|e| Error::MessageOwned(e.to_string()))?;
validate_slice(&buf)
}