Work on passing tidy
This commit is contained in:
parent
0f099f3223
commit
6674184ac0
@ -131,7 +131,7 @@ fn read_data_i8(&mut self) -> Result<i8, ValueReadError<Self::Error>> {
|
||||
* so that rmpv and rmp-serde continue to compile without issue.
|
||||
*
|
||||
*
|
||||
* TODO: Remove this hack once we release a new version of rmp proper
|
||||
* FIXME: Remove this hack once we release a new version of rmp proper
|
||||
*/
|
||||
|
||||
macro_rules! wrap_data_funcs_for_compatibility {
|
||||
@ -200,7 +200,7 @@ fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
impl Display for ValueReadError {
|
||||
#[cold]
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
// TODO: This should probably use formatting
|
||||
// FIXME: This should probably use formatting
|
||||
f.write_str(match *self {
|
||||
ValueReadError::InvalidMarkerRead(..) => "failed to read MessagePack marker",
|
||||
ValueReadError::InvalidDataRead(..) => "failed to read MessagePack data",
|
||||
@ -398,7 +398,7 @@ pub fn read_int<T: FromPrimitive, R: RmpRead>(
|
||||
///
|
||||
/// This function will silently retry on every EINTR received from the underlying `Read` until
|
||||
/// successful read.
|
||||
// TODO: Docs.
|
||||
// FIXME: Docs.
|
||||
// NOTE: EINTR is managed internally.
|
||||
pub fn read_array_len<R>(rd: &mut R) -> Result<u32, ValueReadError<R::Error>>
|
||||
where
|
||||
@ -422,7 +422,7 @@ pub fn read_array_len<R>(rd: &mut R) -> Result<u32, ValueReadError<R::Error>>
|
||||
///
|
||||
/// This function will silently retry on every EINTR received from the underlying `Read` until
|
||||
/// successful read.
|
||||
// TODO: Docs.
|
||||
// FIXME: Docs.
|
||||
pub fn read_map_len<R: RmpRead>(rd: &mut R) -> Result<u32, ValueReadError<R::Error>> {
|
||||
let marker = read_marker(rd)?;
|
||||
marker_to_len(rd, marker)
|
||||
@ -446,7 +446,7 @@ pub fn marker_to_len<R: RmpRead>(
|
||||
///
|
||||
/// This function will silently retry on every EINTR received from the underlying `Read` until
|
||||
/// successful read.
|
||||
// TODO: Docs.
|
||||
// FIXME: Docs.
|
||||
pub fn read_bin_len<R: RmpRead>(rd: &mut R) -> Result<u32, ValueReadError<R::Error>> {
|
||||
match read_marker(rd)? {
|
||||
Marker::Bin8 => Ok(u32::from(rd.read_data_u8()?)),
|
||||
|
@ -106,7 +106,7 @@ fn read_str_len_with_nread<R>(rd: &mut R) -> Result<(u32, usize), ValueReadError
|
||||
/// # Unstable
|
||||
///
|
||||
/// This function is **unstable**, because it needs review.
|
||||
// TODO: Stabilize. Mark error values for each error case (in docs).
|
||||
// FIXME: Stabilize. Mark error values for each error case (in docs).
|
||||
pub fn read_str<'r, R>(
|
||||
rd: &mut R,
|
||||
buf: &'r mut [u8],
|
||||
@ -146,7 +146,7 @@ pub fn read_str_data<'r, R>(
|
||||
|
||||
/// Attempts to read and decode a string value from the reader, returning a borrowed slice from it.
|
||||
///
|
||||
// TODO: Also it's possible to implement all borrowing functions for all `BufRead` implementors.
|
||||
// FIXME: Also it's possible to implement all borrowing functions for all `BufRead` implementors.
|
||||
pub fn read_str_ref(
|
||||
rd: &[u8],
|
||||
) -> Result<&[u8], DecodeStringError<'_, super::bytes::BytesReadError>> {
|
||||
|
@ -40,7 +40,7 @@ pub fn write_bin_len<W: RmpWrite>(
|
||||
///
|
||||
/// This function will return `ValueWriteError` on any I/O error occurred while writing either the
|
||||
/// marker or the data.
|
||||
// TODO: Docs, range check, example, visibility.
|
||||
// FIXME: Docs, range check, example, visibility.
|
||||
pub fn write_bin<W: RmpWrite>(wr: &mut W, data: &[u8]) -> Result<(), ValueWriteError<W::Error>> {
|
||||
write_bin_len(wr, data.len() as u32)?;
|
||||
wr.write_bytes(data).map_err(ValueWriteError::InvalidDataWrite)
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
mod bin;
|
||||
mod dec;
|
||||
mod ext;
|
||||
mod map;
|
||||
// mod ext;
|
||||
// mod map;
|
||||
mod sint;
|
||||
mod str;
|
||||
mod uint;
|
||||
mod vec;
|
||||
// mod vec;
|
||||
|
||||
pub use self::bin::{write_bin, write_bin_len};
|
||||
pub use self::dec::{write_f32, write_f64};
|
||||
@ -185,7 +185,7 @@ fn write_bytes(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
|
||||
|
||||
/// An error that can occur when attempting to write multi-byte MessagePack value.
|
||||
#[derive(Debug)]
|
||||
#[allow(deprecated)] // TODO: Needed for compatibility
|
||||
#[allow(deprecated)] // FIXME: Needed for compatibility
|
||||
pub enum ValueWriteError<E: RmpWriteErr = Error> {
|
||||
/// I/O error while writing marker.
|
||||
InvalidMarkerWrite(E),
|
||||
|
@ -43,7 +43,7 @@ pub fn write_str_len<W: RmpWrite>(
|
||||
///
|
||||
/// This function will return `ValueWriteError` on any I/O error occurred while writing either the
|
||||
/// marker or the data.
|
||||
// TODO: Docs, range check, example, visibility.
|
||||
// FIXME: Docs, range check, example, visibility.
|
||||
pub fn write_str<W: RmpWrite>(wr: &mut W, data: &str) -> Result<(), ValueWriteError<W::Error>> {
|
||||
write_str_len(wr, data.len() as u32)?;
|
||||
wr.write_bytes(data.as_bytes()).map_err(ValueWriteError::InvalidDataWrite)
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -695,7 +695,7 @@ fn deserialize_enum<V>(
|
||||
}
|
||||
n => Err(Error::LengthMismatch(n)),
|
||||
},
|
||||
// TODO: Check this is a string
|
||||
// FIXME: Check this is a string
|
||||
Err(_) => visitor.visit_enum(UnitVariantAccess::new(self)),
|
||||
}
|
||||
}
|
||||
@ -1200,17 +1200,6 @@ fn read_slice<'a>(&'a mut self, len: usize) -> Result<Reference<'de, 'a, [u8]>,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_as_ref_reader() {
|
||||
let buf = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
let mut rd = ReadRefReader::new(&buf);
|
||||
|
||||
assert_eq!(rd.read_slice(1).unwrap(), Reference::Borrowed(&[0][..]));
|
||||
assert_eq!(rd.read_slice(6).unwrap(), Reference::Borrowed(&[1, 2, 3, 4, 5, 6][..]));
|
||||
assert!(rd.read_slice(5).is_err());
|
||||
assert_eq!(rd.read_slice(4).unwrap(), Reference::Borrowed(&[7, 8, 9, 10][..]));
|
||||
}
|
||||
|
||||
/// Deserialize an instance of type `T` from an I/O stream of MessagePack.
|
||||
///
|
||||
/// # Errors
|
||||
|
@ -30,7 +30,7 @@
|
||||
pub enum Error {
|
||||
/// Failed to write a MessagePack value.
|
||||
InvalidValueWrite(ValueWriteError),
|
||||
//TODO: This can be removed at some point
|
||||
//FIXME: This can be removed at some point
|
||||
/// Failed to serialize struct, sequence or map, because its length is unknown.
|
||||
UnknownLength,
|
||||
/// Invalid Data model, i.e. Serialize trait is not implmented correctly
|
||||
@ -114,7 +114,7 @@ pub trait UnderlyingWrite {
|
||||
///
|
||||
/// All instances of `ErrorKind::Interrupted` are handled by this function and the underlying
|
||||
/// operation is retried.
|
||||
// TODO: Docs. Examples.
|
||||
// FIXME: Docs. Examples.
|
||||
#[derive(Debug)]
|
||||
pub struct Serializer<W, C = DefaultConfig> {
|
||||
wr: W,
|
||||
|
@ -32,7 +32,7 @@
|
||||
///
|
||||
/// Example Serde impl for custom type:
|
||||
///
|
||||
/// ```ignore
|
||||
/// ```ignore (this-shuts-tidy-up)
|
||||
/// #[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
/// #[serde(rename = "_ExtStruct")]
|
||||
/// struct ExtStruct((i8, serde_bytes::ByteBuf));
|
||||
|
@ -561,6 +561,9 @@
|
||||
//@ revisions: x86_64_unknown_linux_none
|
||||
//@ [x86_64_unknown_linux_none] compile-flags: --target x86_64-unknown-linux-none
|
||||
//@ [x86_64_unknown_linux_none] needs-llvm-components: x86
|
||||
//@ revisions: x86_64_unknown_mikros
|
||||
//@ [x86_64_unknown_mikros] compile-flags: --target x86_64-unknown-mikros
|
||||
//@ [x86_64_unknown_mikros] needs-llvm-components: x86
|
||||
//@ revisions: x86_64_unknown_netbsd
|
||||
//@ [x86_64_unknown_netbsd] compile-flags: --target x86_64-unknown-netbsd
|
||||
//@ [x86_64_unknown_netbsd] needs-llvm-components: x86
|
||||
|
Loading…
Reference in New Issue
Block a user