File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 22name = " byteview"
33description = " Thin, immutable zero-copy slice type"
44license = " MIT OR Apache-2.0"
5- version = " 0.8.1 "
5+ version = " 0.9.0 "
66edition = " 2021"
77rust-version = " 1.81"
88readme = " README.md"
Original file line number Diff line number Diff line change @@ -17,6 +17,16 @@ Values with a known length can be constructed 2-2.5x faster than using `Arc<[u8]
1717
1818![ Constructor benchmark] ( ctor_bench.png )
1919
20+ ## Sponsors
21+
22+ <a href =" https://sqlsync.dev " >
23+ <picture >
24+ <source width="240" alt="Orbitinghail" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/fjall-rs/fjall-rs.github.io/d22fcb1e6966ce08327ea3bf6cf2ea86a840b071/public/logos/orbitinghail.svg" />
25+ <source width="240" alt="Orbitinghail" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/fjall-rs/fjall-rs.github.io/d22fcb1e6966ce08327ea3bf6cf2ea86a840b071/public/logos/orbitinghail_dark.svg" />
26+ <img width="240" alt="Orbitinghail" src="https://raw.githubusercontent.com/fjall-rs/fjall-rs.github.io/d22fcb1e6966ce08327ea3bf6cf2ea86a840b071/public/logos/orbitinghail_dark.svg" />
27+ </picture >
28+ </a >
29+
2030## Memory usage
2131
2232Allocating 200M "" (len=0) strings:
Original file line number Diff line number Diff line change @@ -210,10 +210,16 @@ impl Drop for Mutator<'_> {
210210impl ByteView {
211211 #[ doc( hidden) ]
212212 #[ must_use]
213- pub fn builder_unzeroed ( len : usize ) -> Builder {
213+ pub unsafe fn builder_unzeroed ( len : usize ) -> Builder {
214214 Builder :: new ( Self :: with_size_unzeroed ( len) )
215215 }
216216
217+ #[ doc( hidden) ]
218+ #[ must_use]
219+ pub fn builder ( len : usize ) -> Builder {
220+ Builder :: new ( Self :: with_size ( len) )
221+ }
222+
217223 fn prefix ( & self ) -> & [ u8 ] {
218224 let len = PREFIX_SIZE . min ( self . len ( ) ) ;
219225
@@ -273,12 +279,10 @@ impl ByteView {
273279 /// Fuses two byte slices into a single byteview.
274280 #[ must_use]
275281 pub fn fused ( left : & [ u8 ] , right : & [ u8 ] ) -> Self {
276- let len: usize = left. len ( ) + right. len ( ) ;
277- let mut builder = Self :: builder_unzeroed ( len) ;
278-
282+ let len = left. len ( ) + right. len ( ) ;
283+ let mut builder = unsafe { Self :: builder_unzeroed ( len) } ;
279284 builder[ 0 ..left. len ( ) ] . copy_from_slice ( left) ;
280285 builder[ left. len ( ) ..] . copy_from_slice ( right) ;
281-
282286 builder. freeze ( )
283287 }
284288
You can’t perform that action at this time.
0 commit comments