3 releases

0.2.0 Aug 29, 2019
0.1.3 Feb 17, 2020
0.1.2 Nov 23, 2019
0.1.1 Aug 29, 2019
0.1.0 Nov 1, 2018

#18 in No standard library

Download history 1722/week @ 2019-12-14 1434/week @ 2019-12-21 2219/week @ 2019-12-28 1692/week @ 2020-01-04 2458/week @ 2020-01-11 1956/week @ 2020-01-18 2368/week @ 2020-01-25 2514/week @ 2020-02-01 2524/week @ 2020-02-08 2479/week @ 2020-02-15 2431/week @ 2020-02-22 2115/week @ 2020-02-29 3452/week @ 2020-03-07 2709/week @ 2020-03-14 2556/week @ 2020-03-21 2917/week @ 2020-03-28

9,224 downloads per month
Used in 364 crates (10 directly)

MIT/Apache

8KB
118 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], &'static mut [u8; 128] and &'static mut GenericArray<u8, U1024> -- all of them are appropriate for DMA transfers.

Minimal Supported Rust Version (MSRV)

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

Dependencies

~195KB