cargo fmt

pull/431/head
Ricky Han 2 years ago
parent 9991ffb093
commit fbfbedb6a8

@ -1,6 +1,7 @@
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData, borrow::Borrow,
marker::PhantomData,
};
use crate::{

@ -1,5 +1,5 @@
//! A Bloom Filter.
use std::{convert::AsRef, marker::PhantomData, borrow::Borrow};
use std::{borrow::Borrow, convert::AsRef, marker::PhantomData};
use crate::{
maps::{check_v_size, MapData, MapError},

@ -1,6 +1,7 @@
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData, borrow::Borrow,
marker::PhantomData,
};
use crate::{
@ -78,7 +79,12 @@ impl<T: AsRef<MapData>, K: Pod, V: Pod> HashMap<T, K, V> {
impl<T: AsMut<MapData>, K: Pod, V: Pod> HashMap<T, K, V> {
/// Inserts a key-value pair into the map.
pub fn insert(&mut self, key: impl Borrow<K>, value: impl Borrow<V>, flags: u64) -> Result<(), MapError> {
pub fn insert(
&mut self,
key: impl Borrow<K>,
value: impl Borrow<V>,
flags: u64,
) -> Result<(), MapError> {
hash_map::insert(self.inner.as_mut(), &key, &value, flags)
}

@ -1,7 +1,8 @@
//! Per-CPU hash map.
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData, borrow::Borrow,
marker::PhantomData,
};
use crate::{
@ -115,7 +116,12 @@ impl<T: AsMut<MapData>, K: Pod, V: Pod> PerCpuHashMap<T, K, V> {
/// )?;
/// # Ok::<(), Error>(())
/// ```
pub fn insert(&mut self, key: impl Borrow<K>, values: PerCpuValues<V>, flags: u64) -> Result<(), MapError> {
pub fn insert(
&mut self,
key: impl Borrow<K>,
values: PerCpuValues<V>,
flags: u64,
) -> Result<(), MapError> {
let fd = self.inner.as_mut().fd_or_err()?;
bpf_map_update_elem_per_cpu(fd, &key, &values, flags).map_err(|(_, io_error)| {
MapError::SyscallError {

@ -1,8 +1,9 @@
//! A LPM Trie.
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData,
mem, borrow::Borrow,
mem,
};
use crate::{
@ -128,7 +129,12 @@ impl<T: AsRef<MapData>, K: Pod, V: Pod> LpmTrie<T, K, V> {
impl<T: AsMut<MapData>, K: Pod, V: Pod> LpmTrie<T, K, V> {
/// Inserts a key value pair into the map.
pub fn insert(&mut self, key: &Key<K>, value: impl Borrow<V>, flags: u64) -> Result<(), MapError> {
pub fn insert(
&mut self,
key: &Key<K>,
value: impl Borrow<V>,
flags: u64,
) -> Result<(), MapError> {
let fd = self.inner.as_mut().fd_or_err()?;
bpf_map_update_elem(fd, Some(key), &value, flags).map_err(|(_, io_error)| {
MapError::SyscallError {

@ -1,7 +1,8 @@
//! A FIFO queue.
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData, borrow::Borrow,
marker::PhantomData,
};
use crate::{

@ -1,7 +1,8 @@
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData,
os::unix::io::{AsRawFd, RawFd}, borrow::Borrow,
os::unix::io::{AsRawFd, RawFd},
};
use crate::{
@ -115,7 +116,12 @@ impl<T: AsRef<MapData>, K: Pod> SockHash<T, K> {
impl<T: AsMut<MapData>, K: Pod> SockHash<T, K> {
/// Inserts a socket under the given key.
pub fn insert<I: AsRawFd>(&mut self, key: impl Borrow<K>, value: I, flags: u64) -> Result<(), MapError> {
pub fn insert<I: AsRawFd>(
&mut self,
key: impl Borrow<K>,
value: I,
flags: u64,
) -> Result<(), MapError> {
hash_map::insert(self.inner.as_mut(), &key, &value.as_raw_fd(), flags)
}

@ -1,7 +1,8 @@
//! A LIFO stack.
use std::{
borrow::Borrow,
convert::{AsMut, AsRef},
marker::PhantomData, borrow::Borrow,
marker::PhantomData,
};
use crate::{

@ -1,4 +1,4 @@
use core::{cell::UnsafeCell, marker::PhantomData, mem, borrow::Borrow};
use core::{borrow::Borrow, cell::UnsafeCell, marker::PhantomData, mem};
use aya_bpf_cty::c_void;

Loading…
Cancel
Save