mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
/target
|
||||
/Cargo.lock
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
|
||||
name = "bytes"
|
||||
version = "0.0.1"
|
||||
authors = ["Carl Lerche <[email protected]>"]
|
||||
description = "Types and traits for working with bytes"
|
||||
license = "MIT"
|
||||
# include = [
|
||||
# "Cargo.toml",
|
||||
# "src/**/*.rs",
|
||||
# ]
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#![crate_name = "bytes"]
|
||||
|
||||
/// A trait for objects that provide random and sequential access to bytes.
|
||||
pub trait Buf {
|
||||
|
||||
fn remaining(&self) -> usize;
|
||||
|
||||
fn bytes<'a>(&'a self) -> &'a [u8];
|
||||
|
||||
fn advance(&mut self, cnt: usize);
|
||||
|
||||
fn has_remaining(&self) -> bool {
|
||||
self.remaining() > 0
|
||||
}
|
||||
}
|
||||
|
||||
pub trait MutBuf : Buf {
|
||||
fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8];
|
||||
}
|
||||
Reference in New Issue
Block a user