MCPcopy Create free account
hub / github.com/3Hren/msgpack-rust / emit_enum

Method emit_enum

src/encode.rs:1070–1078  ·  view source on GitHub ↗

Encodes and attempts to write the enum value into the Write. Currently we encode variant types as a tuple of id with array of args, like: [id, [args...]]

(&mut self, _name: &str, f: F)

Source from the content-addressed store, hash-verified

1068 ///
1069 /// Currently we encode variant types as a tuple of id with array of args, like: [id, [args...]]
1070 fn emit_enum<F>(&mut self, _name: &str, f: F) -> Result<(), Error>
1071 where F: FnOnce(&mut Self) -> Result<(), Error>
1072 {
1073 // Mark that we want to encode a variant type.
1074 try!(write_array_len(&mut self.wr, 2));
1075
1076 // Delegate to the encoder of a concrete value.
1077 f(self)
1078 }
1079
1080 /// Encodes and attempts to write a concrete variant value.
1081 fn emit_enum_variant<F>(&mut self, _name: &str, id: usize, len: usize, f: F) -> Result<(), Error>

Callers

nothing calls this directly

Calls 1

write_array_lenFunction · 0.85

Tested by

no test coverage detected