6 releases

Uses old Rust 2015

0.2.1 Mar 25, 2021
0.2.0 Aug 29, 2019
0.1.5 Mar 2, 2021
0.1.4 Sep 23, 2020
0.1.0 Nov 1, 2018

#57 in No standard library

Download history 16649/week @ 2024-07-20 15346/week @ 2024-07-27 14988/week @ 2024-08-03 17954/week @ 2024-08-10 17881/week @ 2024-08-17 17555/week @ 2024-08-24 19894/week @ 2024-08-31 17085/week @ 2024-09-07 16275/week @ 2024-09-14 18966/week @ 2024-09-21 16344/week @ 2024-09-28 15767/week @ 2024-10-05 16656/week @ 2024-10-12 18223/week @ 2024-10-19 17260/week @ 2024-10-26 19663/week @ 2024-11-02

74,155 downloads per month
Used in 832 crates (13 directly)

MIT/Apache

7KB
59 lines

as-slice

AsSlice and AsMutSlice traits

Change log

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

AsSlice and AsMutSlice traits

These traits are somewhat similar to the AsRef and AsMut except that they are NOT polymorphic (no input type parameter) and their methods always return slices ([T]).

The main use case of these traits is writing generic code that accepts (fixed size) buffers. For example, a bound T: StableDeref + AsMutSlice<Element = u8> + 'static will accepts types like &'static mut [u8] and &'static mut [u8; 128] -- all of them are appropriate for DMA transfers.

Minimal Supported Rust Version (MSRV)

This crate is guaranteed to compile on stable Rust 1.51 and up. It might compile on older versions but that may change in any new patch release.

Dependencies

~9KB