renamed emit_nil to emit_unit

This commit is contained in:
kenta7777 2018-09-11 23:32:41 +09:00
parent a0e7b6bf6b
commit 8134ee25b8
5 changed files with 10 additions and 10 deletions

View File

@ -1020,7 +1020,7 @@ impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E>
{
type Error = E::Error;
fn emit_nil(&mut self) -> Result<(), Self::Error> {
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}

View File

@ -75,7 +75,7 @@ macro_rules! encoder_methods {
impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> {
type Error = <opaque::Encoder as Encoder>::Error;
fn emit_nil(&mut self) -> Result<(), Self::Error> {
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}

View File

@ -490,7 +490,7 @@ macro_rules! emit_enquoted_if_mapkey {
impl<'a> ::Encoder for Encoder<'a> {
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); }
write!(self.writer, "null")?;
Ok(())
@ -648,7 +648,7 @@ impl<'a> ::Encoder for Encoder<'a> {
}
fn emit_option_none(&mut self) -> EncodeResult {
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
F: FnOnce(&mut Encoder<'a>) -> EncodeResult,
@ -740,7 +740,7 @@ impl<'a> PrettyEncoder<'a> {
impl<'a> ::Encoder for PrettyEncoder<'a> {
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); }
write!(self.writer, "null")?;
Ok(())
@ -923,7 +923,7 @@ impl<'a> ::Encoder for PrettyEncoder<'a> {
}
fn emit_option_none(&mut self) -> EncodeResult {
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
F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult,
@ -1016,7 +1016,7 @@ impl Encodable for Json {
Json::Boolean(v) => v.encode(e),
Json::Array(ref v) => v.encode(e),
Json::Object(ref v) => v.encode(e),
Json::Null => e.emit_nil(),
Json::Null => e.emit_unit(),
}
}
}

View File

@ -55,7 +55,7 @@ impl serialize::Encoder for Encoder {
type Error = !;
#[inline]
fn emit_nil(&mut self) -> EncodeResult {
fn emit_unit(&mut self) -> EncodeResult {
Ok(())
}

View File

@ -25,7 +25,7 @@ pub trait Encoder {
type Error;
// 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_u128(&mut self, v: u128) -> Result<(), Self::Error>;
fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>;
@ -537,7 +537,7 @@ impl Decodable for char {
impl Encodable for () {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
s.emit_nil()
s.emit_unit()
}
}