Commit Graph

392 Commits

Author SHA1 Message Date
Ralf Jung caff82bb54 use Box::into_raw instead of mem-forget-in-disguise (#458) 2020-12-31 15:07:28 +01:00
laizy 4921a32c48 add inline for Vec::put_slice (#459) 2020-12-31 12:34:39 +01:00
Ralf Jung c061be06e7 CI: run test suite in Miri (#456) 2020-12-29 22:54:48 +01:00
Alice Ryhl ab9d9aa32c Fix deprecation warning (#457) 2020-12-29 22:46:39 +01:00
Carl Lerche ab49a91d86 chore: prepare v1.0.0 release (#453) 2020-12-22 15:30:20 -08:00
Taiki Endo 785d972242 deps: update loom to 0.4 (#452) 2020-12-22 10:30:50 +01:00
Arve Knudsen 21b7fec15e Update readme / changelog (#451) 2020-12-20 07:31:22 -08:00
Carl Lerche d40a3d70c1 Rename Buf/BufMut, methods to chunk/chunk_mut (#450)
The `bytes()` / `bytes_mut()` name implies the method returns the full
set of bytes represented by `Buf`/`BufMut`. To rectify this, the methods
are renamed to `chunk()` and `chunk_mut()` to reflect the partial nature
of the returned byte slice.

`bytes_vectored()` is renamed `chunks_vectored()`.

Closes #447
2020-12-18 11:04:31 -08:00
Carl Lerche a1d54b1c27 remove unused Buf implementation. (#449)
The implementation of `Buf` for `Option<[u8; 1]>` was added to support
`IntoBuf`. The `IntoBuf` trait has since been removed.

Closes #444
2020-12-16 21:51:13 -08:00
Carl Lerche e52da8e1cb chore: prepare for v1.0.0 work (#448) 2020-12-12 08:25:14 -08:00
Ibraheem Ahmed 1772ea8874 Upgrade bytes version from 0.5 to 0.6.0 in README (#441) 2020-11-02 00:10:51 +09:00
Carl Lerche b8e1c52738 prepare v0.6.0 release (#440) 2020-10-20 16:08:25 -07:00
Carl Lerche d58e99485c Add Buf::copy_to_bytes(len) (#439)
This method replaces `Buf::to_bytes()`, providing a method that copies a
subset of the remaining buffer into a `Bytes` value. As this is strictly
more flexible, `to_bytes()` is removed.

Fixes: #129, #398
2020-10-20 11:00:35 -07:00
Carl Lerche 143861dec0 use checked addition with range (#438) 2020-10-20 10:26:38 -07:00
Carl Lerche 14b4e28a5f Switch BufMut::bytes_mut to&mut UninitSlice (#433)
The way BufMut uses MaybeUninit can lead to unsoundness. This replaces
MaybeUnit with a type owned by bytes so we can ensure the usage patterns
are sound.

Refs: #328
2020-10-19 15:48:23 -07:00
Matthias Einwag 79842672f4 De-emphasize Arc implementation in Bytes description (#436)
The previous description focussed a lot on the `Arc` based implementation
of `Bytes`. Given the vtable based implemetation, this is however not the
only valid implementation. This changes the description a bit in order
to de-emaphasize the `Arc` part, and to describe that other implementations
are possible.

This should also be necessary if the vtable gets public.
2020-10-19 12:32:20 -07:00
Carl Lerche 003543a312 remove new fns from combinator structs (#434)
This is not idiomatic.
2020-10-18 09:55:19 -07:00
Carl Lerche 16c888fbea Make BufMut an unsafe trait (#432)
Users of `BufMut` are unable to defend against incorrect implementations
of `BufMut`, this makes the trait unsafe to implement.

Fixes #329
2020-10-16 15:45:38 -07:00
Carl Lerche ad16e65c28 remove ext traits (#431) 2020-10-16 15:16:23 -07:00
Carl Lerche 69b7e70509 Remove BufMut::bytes_vectored_mut() (#430)
There are issues with regard to uninitialized memory. We are avoiding
stabilizing this function for now.
2020-10-16 11:56:03 -07:00
Carl Lerche 5133606f40 prepare for 0.6 work (#428) 2020-10-16 11:49:27 -07:00
Sean McArthur 8ec9733fc7 v0.5.6 2020-07-13 17:58:36 -07:00
Sean McArthur 6c9664f09f Move loom to dev-dependencies (#416) 2020-07-13 16:55:47 -07:00
Taiki Endo 04b732a082 Fix CI failure on Windows (#415)
--no-self-update is necessary because the windows environment cannot
self-update rustup.exe.
2020-07-13 12:33:30 +09:00
Taiki Endo 63c9265f3c Change default lint level to warning and deny warnings in CI (#397) 2020-07-09 09:12:39 -07:00
Sean Leather 6ccbcdfbc0 docs: Clarify what BytesMut is (#375) 2020-07-09 09:11:45 -07:00
Bryan Donlan b83ea40780 BytesMut: Reuse buffer when data fully consumed via Buf
Closes #412
2020-07-08 15:28:36 -07:00
Tomasz Miąsko 1e82681d16 Use ThreadSanitizer CI setup that avoids false positives (#406) 2020-07-07 01:28:47 +09:00
Juan Aguilar 2e16777240 Add inline attribute to BytesMut::as_mut (#410) 2020-07-05 17:43:26 -07:00
Juan Aguilar e81e1c3c4e Add inline attribute to BytesMut::set_len (#408) 2020-07-03 16:47:32 -07:00
Tomasz Miąsko 3d28557ac0 Remove unnecessary synchronization when cloning shared representation (#404) 2020-07-02 18:55:16 -07:00
Sean McArthur 7e158a1f92 v0.5.5 2020-06-18 14:30:11 -07:00
Mikhail Zabaluev c5fe74761d Remove outdated info on BytesMut::with_capacity (#394)
Remove a remark from the doc that pertained to the inline
layout and is no longer true.
2020-05-27 22:02:45 -07:00
Taiki Endo 0218965db5 Migrate CI to GitHub Actions (#392) 2020-05-25 01:41:45 +09:00
Taiki Endo 7c29088aa4 Deny warnings for doc tests (#391) 2020-05-24 06:30:50 +09:00
Kirill Fomichev 0142960b4e Fix reference in Take docs (#383) 2020-05-22 14:33:06 +09:00
Taiki Endo 9a2e275ae3 Format with rustfmt (#389)
* Format with rustfmt

* Add rustfmt check to CI
2020-05-22 13:17:30 +09:00
Sean McArthur e186368e5b Update to loom v0.3 (#381) 2020-05-22 11:23:22 +09:00
Cheng XU 9e4da2b6cc Allow using serde feature in no_std environment (#385)
When `serde` is used, it would enable its default feature `std`.
This of course breaks no_std build.

Fix this by disabling serde's default features. This should work for
both serde + std and serde + no_std case.
2020-05-22 11:19:46 +09:00
Cheng XU 90581d7f26 Fix tests for no_std build (#384)
This fixes `cargo test --no-default-features`.
2020-05-22 11:18:20 +09:00
Taiki Endo ce1d504c17 Fix CI failure on MacOS (#388)
macOS-10.13 has been removed.
2020-05-22 10:54:52 +09:00
Tim Hambourger f9e9196d20 Fix #354 -- Make advance_mut impl of BufMut for Vec<u8> panic if cnt > remaining 2020-03-25 12:30:15 -07:00
Tim Hambourger 90775ac26f Fix #352 -- Make freeze respect the start offset for BytesMuts in Vec mode 2020-03-24 11:14:16 -07:00
Sean McArthur 24b159c016 v0.5.4 2020-01-23 10:41:50 -08:00
Stepan Koltsov a4b63406c7 Do not panic on Bytes::slice_ref on empty slice (#355)
Use case:

```
let bytes: Bytes = ...
let subbytes = bytes.slice(a..b); // where a == b
let slice = &subbytes[..];
let slice_bytes = bytes.slice_ref(slice);
```

Last line should not panic, because `slice` object is derived from
the original `Bytes` object.

Before this commit it panics, because `Bytes::slice` returns a fresh
`Bytes` object when `begin == end`.
2020-01-23 10:29:42 -08:00
Sean McArthur 3861bf1217 Disable loom on Windows (#366) 2020-01-23 10:10:15 -08:00
南浦月 f812a9f70e merge hex & debug into fmt (#357) 2020-01-23 10:08:40 -08:00
Nikhil Benesch 5a5bb9ed2a Minor documentation fixes (#351)
* Remove incorrect comment about behavior of put_slice
* Improve grammar and clarity of BytesMut documentation
2020-01-23 10:06:49 -08:00
Andrew Tunnell-Jones 5369a989a4 Fix reversed arguments in PartialOrd impls (#358) 2020-01-23 10:06:00 -08:00
John-John Tedro 1efd9958a3 Assert that the alignment of Shared is appropriate (#362) 2020-01-23 10:05:20 -08:00