Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.
/ slice_queue Public archive

This library provides an VecDeque for efficient working with (byte-)slices

Notifications You must be signed in to change notification settings

KizzyCode/slice_queue

Repository files navigation

License License Travis CI AppVeyor CI

slice_queue

Welcome to my slice_queue-library 🎊

About This Library

This library provides an optimized queue for efficient working with (byte-)slices. It allows you to

  • efficiently push an arbitrary amount of elements to the back by either consuming them or by cloning/copying them from a slice (if the type supports the Clone/Copy trait)
  • communicate and enforce a limit on the amount of elements to store
  • efficiently pop an arbitrary amount of elements from the front (optionally into a slice to avoid unneccessary reallocations)
  • access the underlying buffer directly by using (range-)indices
  • dereference the SliceQueue<T> by propagating the deref()-call to the underlying Vec<T> (can be disabled; see Feature-Gates)
  • access it using the io::Read and io::Write traits
  • "split" it into R/W-halves using the ReadableSliceQueue<T> and WriteableSliceQueue<T> traits or the io::Read and io::Write traits

Feature-Gates

  • deref: This feature allows you to deref the SliceQueue<T> by propagating any deref()-call to the underlying Vec<T> (which usually results in a slice). Because in some projects this could be considered as "bad practice", it is possible to disable this behaviour. This feature is enabled by default.
  • unsafe_fast_code: Because the main goal of this library is performance, we use raw pointer access and manual memory management in some places. Especially for Copy-types like u8, this improves the performance dramatically. Since this requires unsafe code which may be not acceptable in your case, it is possible to replace the unsafe code with safe Vec-operations by disabling this feature. This feature is enabled by default.

Build Documentation and Library:

To build and open the documentation, go into the project's root-directory and run cargo doc --release --open

To build this library, change into the projects root-directory and run cargo build --release (or cargo build --release --features ... to manually specify the features to use); you can find the build in target/release.

If you use this library for the first time or after an update, we recommend you to run cargo test --release (or cargo test --release --features ... to manually specify the features to use).

About

This library provides an VecDeque for efficient working with (byte-)slices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages