Skip to content

Implement std::io traits for Coded*Streams#232

Merged
stepancheg merged 4 commits into
stepancheg:masterfrom
miedzinski:io-traits
Jun 28, 2017
Merged

Implement std::io traits for Coded*Streams#232
stepancheg merged 4 commits into
stepancheg:masterfrom
miedzinski:io-traits

Conversation

@miedzinski

Copy link
Copy Markdown
Contributor

Fixes #229.

Comment thread protobuf/src/buf_read_iter.rs Outdated
}

fn _read(&mut self, buf: &mut [u8]) -> ProtobufResult<usize> {
pub(crate) fn _read(&mut self, buf: &mut [u8]) -> ProtobufResult<usize> {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub is enough, since BufReadIter is not an exported type.

Could you rename function to read, without underscore please?

Comment thread protobuf/src/stream.rs Outdated
use std::mem;
use std::io::{BufRead, Read};
use std::io::Write;
use std::io::Result as IOResult;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use std::io and then io::Result I think would be better.

Comment thread protobuf/src/stream.rs Outdated
}

fn flush(&mut self) -> IOResult<()> {
self.flush().map_err(Into::into)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodedOutputStream::flush(self) would be clearer I think to make sure that there is no recursion here.

@miedzinski

Copy link
Copy Markdown
Contributor Author

@stepancheg done!

@stepancheg stepancheg merged commit 28b3213 into stepancheg:master Jun 28, 2017
@stepancheg

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants