mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
477 B
Rust
16 lines
477 B
Rust
use core::{mem, ptr, slice};
|
|
#[cfg(feature = "std")]
|
|
pub(crate) use std::collections::HashMap;
|
|
#[cfg(feature = "std")]
|
|
pub(crate) use std::collections::HashSet;
|
|
|
|
#[cfg(not(feature = "std"))]
|
|
pub(crate) use hashbrown::HashMap;
|
|
#[cfg(not(feature = "std"))]
|
|
pub(crate) use hashbrown::HashSet;
|
|
|
|
/// bytes_of converts a <T> to a byte slice
|
|
pub(crate) unsafe fn bytes_of<T>(val: &T) -> &[u8] {
|
|
unsafe { slice::from_raw_parts(ptr::from_ref(val).cast(), mem::size_of_val(val)) }
|
|
}
|