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(())
}
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(())
}
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,
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(())
}
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,
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(),
}
}
}
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>;
impl Encodable for () {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
- s.emit_nil()
+ s.emit_unit()
}
}