We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 72176cf commit fc2424bCopy full SHA for fc2424b
src/libserialize/opaque.rs
@@ -27,6 +27,10 @@ impl<'a> Encoder<'a> {
27
pub fn new(cursor: &'a mut io::Cursor<Vec<u8>>) -> Encoder<'a> {
28
Encoder { cursor: cursor }
29
}
30
+
31
+ pub fn emit_raw_bytes(&mut self, s: &[u8]) -> EncodeResult {
32
+ self.cursor.write_all(s)
33
+ }
34
35
36
@@ -169,6 +173,16 @@ impl<'a> Decoder<'a> {
169
173
pub fn advance(&mut self, bytes: usize) {
170
174
self.position += bytes;
171
175
176
177
+ pub fn read_raw_bytes(&mut self, s: &mut [u8]) -> Result<(), String> {
178
+ let len = s.len();
179
180
+ self.position += len;
181
182
+ s.copy_from_slice(&self.data[0..len]);
183
184
+ Ok(())
185
172
186
187
188
macro_rules! read_uleb128 {
0 commit comments