mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
renamed emit_nil to emit_unit
This commit is contained in:
parent
a0e7b6bf6b
commit
8134ee25b8
@ -1020,7 +1020,7 @@ impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E>
|
|||||||
{
|
{
|
||||||
type Error = E::Error;
|
type Error = E::Error;
|
||||||
|
|
||||||
fn emit_nil(&mut self) -> Result<(), Self::Error> {
|
fn emit_unit(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ macro_rules! encoder_methods {
|
|||||||
impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> {
|
impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> {
|
||||||
type Error = <opaque::Encoder as Encoder>::Error;
|
type Error = <opaque::Encoder as Encoder>::Error;
|
||||||
|
|
||||||
fn emit_nil(&mut self) -> Result<(), Self::Error> {
|
fn emit_unit(&mut self) -> Result<(), Self::Error> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ macro_rules! emit_enquoted_if_mapkey {
|
|||||||
impl<'a> ::Encoder for Encoder<'a> {
|
impl<'a> ::Encoder for Encoder<'a> {
|
||||||
type Error = EncoderError;
|
type Error = EncoderError;
|
||||||
|
|
||||||
fn emit_nil(&mut self) -> EncodeResult {
|
fn emit_unit(&mut self) -> EncodeResult {
|
||||||
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
||||||
write!(self.writer, "null")?;
|
write!(self.writer, "null")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -648,7 +648,7 @@ impl<'a> ::Encoder for Encoder<'a> {
|
|||||||
}
|
}
|
||||||
fn emit_option_none(&mut self) -> EncodeResult {
|
fn emit_option_none(&mut self) -> EncodeResult {
|
||||||
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
||||||
self.emit_nil()
|
self.emit_unit()
|
||||||
}
|
}
|
||||||
fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
|
fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
|
||||||
F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
|
F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
|
||||||
@ -740,7 +740,7 @@ impl<'a> PrettyEncoder<'a> {
|
|||||||
impl<'a> ::Encoder for PrettyEncoder<'a> {
|
impl<'a> ::Encoder for PrettyEncoder<'a> {
|
||||||
type Error = EncoderError;
|
type Error = EncoderError;
|
||||||
|
|
||||||
fn emit_nil(&mut self) -> EncodeResult {
|
fn emit_unit(&mut self) -> EncodeResult {
|
||||||
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
||||||
write!(self.writer, "null")?;
|
write!(self.writer, "null")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -923,7 +923,7 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
|
|||||||
}
|
}
|
||||||
fn emit_option_none(&mut self) -> EncodeResult {
|
fn emit_option_none(&mut self) -> EncodeResult {
|
||||||
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
|
||||||
self.emit_nil()
|
self.emit_unit()
|
||||||
}
|
}
|
||||||
fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
|
fn emit_option_some<F>(&mut self, f: F) -> EncodeResult where
|
||||||
F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
|
F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
|
||||||
@ -1016,7 +1016,7 @@ impl Encodable for Json {
|
|||||||
Json::Boolean(v) => v.encode(e),
|
Json::Boolean(v) => v.encode(e),
|
||||||
Json::Array(ref v) => v.encode(e),
|
Json::Array(ref v) => v.encode(e),
|
||||||
Json::Object(ref v) => v.encode(e),
|
Json::Object(ref v) => v.encode(e),
|
||||||
Json::Null => e.emit_nil(),
|
Json::Null => e.emit_unit(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ impl serialize::Encoder for Encoder {
|
|||||||
type Error = !;
|
type Error = !;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn emit_nil(&mut self) -> EncodeResult {
|
fn emit_unit(&mut self) -> EncodeResult {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ pub trait Encoder {
|
|||||||
type Error;
|
type Error;
|
||||||
|
|
||||||
// Primitive types:
|
// Primitive types:
|
||||||
fn emit_nil(&mut self) -> Result<(), Self::Error>;
|
fn emit_unit(&mut self) -> Result<(), Self::Error>;
|
||||||
fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>;
|
fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>;
|
||||||
fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>;
|
fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>;
|
||||||
fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>;
|
fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>;
|
||||||
@ -537,7 +537,7 @@ impl Decodable for char {
|
|||||||
|
|
||||||
impl Encodable for () {
|
impl Encodable for () {
|
||||||
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
|
||||||
s.emit_nil()
|
s.emit_unit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user