Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bytestr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub struct ByteString(Vec<u8>);

impl ByteString {
/// Create a new byte string from a vector or slice of bytes.
pub fn from_bytes<S: CloneableVector<u8>>(bs: S) -> ByteString {
ByteString(bs.into_vec())
pub fn from_bytes<S: AsSlice<u8>>(bs: S) -> ByteString {
ByteString(bs.as_slice().to_vec())
}

/// Consumes this byte string into a vector of bytes.
Expand Down
2 changes: 1 addition & 1 deletion src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl Encoded {
/// to access the raw CSV record.
pub fn unwrap(self) -> Vec<ByteString> { self.record }

fn push_bytes<S: CloneableVector<u8>>(&mut self, s: S) -> CsvResult<()> {
fn push_bytes<S: AsSlice<u8>>(&mut self, s: S) -> CsvResult<()> {
self.record.push(ByteString::from_bytes(s));
Ok(())
}
Expand Down
4 changes: 2 additions & 2 deletions src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ impl Reader<MemReader> {
}

/// Creates a CSV reader for an in memory buffer of bytes.
pub fn from_bytes<V: CloneableVector<u8>>(bytes: V) -> Reader<MemReader> {
Reader::from_reader(MemReader::new(bytes.into_vec()))
pub fn from_bytes<V: AsSlice<u8>>(bytes: V) -> Reader<MemReader> {
Reader::from_reader(MemReader::new(bytes.as_slice().to_vec()))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn ordie<T, E: ::std::fmt::Show>(res: Result<T, E>) -> T {
}
}

fn bytes<S: CloneableVector<u8>>(bs: S) -> ByteString {
fn bytes<S: AsSlice<u8>>(bs: S) -> ByteString {
ByteString::from_bytes(bs)
}

Expand Down