mirror of
				https://github.com/serde-rs/json.git
				synced 2025-11-04 07:23:07 +00:00 
			
		
		
		
	Standardize on "I/O" instead of "IO"
This commit is contained in:
		
							parent
							
								
									6fda3853e4
								
							
						
					
					
						commit
						207a57b688
					
				@ -2408,9 +2408,9 @@ where
 | 
				
			|||||||
    Ok(value)
 | 
					    Ok(value)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Deserialize an instance of type `T` from an IO stream of JSON.
 | 
					/// Deserialize an instance of type `T` from an I/O stream of JSON.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// The content of the IO stream is deserialized directly from the stream
 | 
					/// The content of the I/O stream is deserialized directly from the stream
 | 
				
			||||||
/// without being buffered in memory by serde_json.
 | 
					/// without being buffered in memory by serde_json.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// When reading from a source against which short reads are not efficient, such
 | 
					/// When reading from a source against which short reads are not efficient, such
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								src/error.rs
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								src/error.rs
									
									
									
									
									
								
							@ -36,15 +36,16 @@ impl Error {
 | 
				
			|||||||
    /// The first character in the input and any characters immediately
 | 
					    /// The first character in the input and any characters immediately
 | 
				
			||||||
    /// following a newline character are in column 1.
 | 
					    /// following a newline character are in column 1.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// Note that errors may occur in column 0, for example if a read from an IO
 | 
					    /// Note that errors may occur in column 0, for example if a read from an
 | 
				
			||||||
    /// stream fails immediately following a previously read newline character.
 | 
					    /// I/O stream fails immediately following a previously read newline
 | 
				
			||||||
 | 
					    /// character.
 | 
				
			||||||
    pub fn column(&self) -> usize {
 | 
					    pub fn column(&self) -> usize {
 | 
				
			||||||
        self.err.column
 | 
					        self.err.column
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Categorizes the cause of this error.
 | 
					    /// Categorizes the cause of this error.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// - `Category::Io` - failure to read or write bytes on an IO stream
 | 
					    /// - `Category::Io` - failure to read or write bytes on an I/O stream
 | 
				
			||||||
    /// - `Category::Syntax` - input that is not syntactically valid JSON
 | 
					    /// - `Category::Syntax` - input that is not syntactically valid JSON
 | 
				
			||||||
    /// - `Category::Data` - input data that is semantically incorrect
 | 
					    /// - `Category::Data` - input data that is semantically incorrect
 | 
				
			||||||
    /// - `Category::Eof` - unexpected end of the input data
 | 
					    /// - `Category::Eof` - unexpected end of the input data
 | 
				
			||||||
@ -76,7 +77,7 @@ impl Error {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Returns true if this error was caused by a failure to read or write
 | 
					    /// Returns true if this error was caused by a failure to read or write
 | 
				
			||||||
    /// bytes on an IO stream.
 | 
					    /// bytes on an I/O stream.
 | 
				
			||||||
    pub fn is_io(&self) -> bool {
 | 
					    pub fn is_io(&self) -> bool {
 | 
				
			||||||
        self.classify() == Category::Io
 | 
					        self.classify() == Category::Io
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -109,7 +110,7 @@ impl Error {
 | 
				
			|||||||
/// Categorizes the cause of a `serde_json::Error`.
 | 
					/// Categorizes the cause of a `serde_json::Error`.
 | 
				
			||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
 | 
					#[derive(Copy, Clone, PartialEq, Eq, Debug)]
 | 
				
			||||||
pub enum Category {
 | 
					pub enum Category {
 | 
				
			||||||
    /// The error was caused by a failure to read or write bytes on an IO
 | 
					    /// The error was caused by a failure to read or write bytes on an I/O
 | 
				
			||||||
    /// stream.
 | 
					    /// stream.
 | 
				
			||||||
    Io,
 | 
					    Io,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -134,8 +135,8 @@ pub enum Category {
 | 
				
			|||||||
impl From<Error> for io::Error {
 | 
					impl From<Error> for io::Error {
 | 
				
			||||||
    /// Convert a `serde_json::Error` into an `io::Error`.
 | 
					    /// Convert a `serde_json::Error` into an `io::Error`.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// JSON syntax and data errors are turned into `InvalidData` IO errors.
 | 
					    /// JSON syntax and data errors are turned into `InvalidData` I/O errors.
 | 
				
			||||||
    /// EOF errors are turned into `UnexpectedEof` IO errors.
 | 
					    /// EOF errors are turned into `UnexpectedEof` I/O errors.
 | 
				
			||||||
    ///
 | 
					    ///
 | 
				
			||||||
    /// ```
 | 
					    /// ```
 | 
				
			||||||
    /// use std::io;
 | 
					    /// use std::io;
 | 
				
			||||||
@ -182,7 +183,7 @@ pub(crate) enum ErrorCode {
 | 
				
			|||||||
    /// Catchall for syntax error messages
 | 
					    /// Catchall for syntax error messages
 | 
				
			||||||
    Message(Box<str>),
 | 
					    Message(Box<str>),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Some IO error occurred while serializing or deserializing.
 | 
					    /// Some I/O error occurred while serializing or deserializing.
 | 
				
			||||||
    Io(io::Error),
 | 
					    Io(io::Error),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// EOF while parsing a list.
 | 
					    /// EOF while parsing a list.
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ pub enum ErrorKind {
 | 
				
			|||||||
    Other,
 | 
					    Other,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// IO errors can never occur in no-std mode. All our no-std IO implementations
 | 
					// I/O errors can never occur in no-std mode. All our no-std I/O implementations
 | 
				
			||||||
// are infallible.
 | 
					// are infallible.
 | 
				
			||||||
pub struct Error;
 | 
					pub struct Error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2062,7 +2062,7 @@ static ESCAPE: [u8; 256] = [
 | 
				
			|||||||
    __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // F
 | 
					    __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // F
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Serialize the given data structure as JSON into the IO stream.
 | 
					/// Serialize the given data structure as JSON into the I/O stream.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Serialization guarantees it only feeds valid UTF-8 sequences to the writer.
 | 
					/// Serialization guarantees it only feeds valid UTF-8 sequences to the writer.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
@ -2081,7 +2081,7 @@ where
 | 
				
			|||||||
    value.serialize(&mut ser)
 | 
					    value.serialize(&mut ser)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Serialize the given data structure as pretty-printed JSON into the IO
 | 
					/// Serialize the given data structure as pretty-printed JSON into the I/O
 | 
				
			||||||
/// stream.
 | 
					/// stream.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
/// Serialization guarantees it only feeds valid UTF-8 sequences to the writer.
 | 
					/// Serialization guarantees it only feeds valid UTF-8 sequences to the writer.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user