|
|
@ -11,6 +11,28 @@ use crate::{
|
|
|
|
maps::PinningType,
|
|
|
|
maps::PinningType,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A hash map that can be shared between eBPF programs and user-space.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Minimum kernel version
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// The minimum kernel version required to use this feature is 3.19.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::HashMap};
|
|
|
|
|
|
|
|
/// # use aya_bpf::programs::LsmContext;
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// static MY_MAP: HashMap<u32, u32> = HashMap::with_max_entries(1024, 0);
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # unsafe fn try_test(ctx: &LsmContext) -> Result<i32, i32> {
|
|
|
|
|
|
|
|
/// let key: u32 = 13;
|
|
|
|
|
|
|
|
/// let value: u32 = 42;
|
|
|
|
|
|
|
|
/// MY_MAP.insert(&key, &value, 0).map_err(|e| e as i32)?;
|
|
|
|
|
|
|
|
/// # Ok(0)
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
#[repr(transparent)]
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub struct HashMap<K, V> {
|
|
|
|
pub struct HashMap<K, V> {
|
|
|
|
def: UnsafeCell<bpf_map_def>,
|
|
|
|
def: UnsafeCell<bpf_map_def>,
|
|
|
@ -21,6 +43,16 @@ pub struct HashMap<K, V> {
|
|
|
|
unsafe impl<K: Sync, V: Sync> Sync for HashMap<K, V> {}
|
|
|
|
unsafe impl<K: Sync, V: Sync> Sync for HashMap<K, V> {}
|
|
|
|
|
|
|
|
|
|
|
|
impl<K, V> HashMap<K, V> {
|
|
|
|
impl<K, V> HashMap<K, V> {
|
|
|
|
|
|
|
|
/// Creates a `HashMap` with the maximum number of elements.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::HashMap};
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// static mut MY_MAP: HashMap<u32, u32> = HashMap::with_max_entries(1024, 0);
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> HashMap<K, V> {
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> HashMap<K, V> {
|
|
|
|
HashMap {
|
|
|
|
HashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -34,6 +66,17 @@ impl<K, V> HashMap<K, V> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Creates an empty `HashMap<K, V>` with the specified maximum number of
|
|
|
|
|
|
|
|
/// elements, and pins it to the BPF file system (BPFFS).
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::HashMap};
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// static mut MY_MAP: HashMap<u32, u32> = HashMap::pinned(1024, 0);
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> HashMap<K, V> {
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> HashMap<K, V> {
|
|
|
|
HashMap {
|
|
|
|
HashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -52,12 +95,33 @@ impl<K, V> HashMap<K, V> {
|
|
|
|
/// make guarantee on the atomicity of `insert` or `remove`, and any element removed from the
|
|
|
|
/// make guarantee on the atomicity of `insert` or `remove`, and any element removed from the
|
|
|
|
/// map might get aliased by another element in the map, causing garbage to be read, or
|
|
|
|
/// map might get aliased by another element in the map, causing garbage to be read, or
|
|
|
|
/// corruption in case of writes.
|
|
|
|
/// corruption in case of writes.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::HashMap};
|
|
|
|
|
|
|
|
/// # use aya_bpf::programs::XdpContext;
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// static REDIRECT_PORTS: HashMap<u16, u16> = HashMap::with_max_entries(1024, 0);
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # fn parse_source(ctx: &XdpContext) -> u16 { 0 }
|
|
|
|
|
|
|
|
/// # fn try_test(ctx: &XdpContext) -> Result<i32, i32> {
|
|
|
|
|
|
|
|
/// // Source port of the packet.
|
|
|
|
|
|
|
|
/// let source: u16 = parse_source(&ctx);
|
|
|
|
|
|
|
|
/// // Port to which we want redirect the packet to.
|
|
|
|
|
|
|
|
/// let redirect = MY_MAP.get(&source);
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// // Redirect the packet.
|
|
|
|
|
|
|
|
/// # Ok(0)
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub unsafe fn get(&self, key: &K) -> Option<&V> {
|
|
|
|
pub unsafe fn get(&self, key: &K) -> Option<&V> {
|
|
|
|
get(self.def.get(), key)
|
|
|
|
get(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Retrieve the value associate with `key` from the map.
|
|
|
|
/// Retrieves the value associate with `key` from the map.
|
|
|
|
/// The same caveat as `get` applies, but this returns a raw pointer and it's up to the caller
|
|
|
|
/// The same caveat as `get` applies, but this returns a raw pointer and it's up to the caller
|
|
|
|
/// to decide whether it's safe to dereference the pointer or not.
|
|
|
|
/// to decide whether it's safe to dereference the pointer or not.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
@ -65,7 +129,7 @@ impl<K, V> HashMap<K, V> {
|
|
|
|
get_ptr(self.def.get(), key)
|
|
|
|
get_ptr(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Retrieve the value associate with `key` from the map.
|
|
|
|
/// Retrieves the value associate with `key` from the map.
|
|
|
|
/// The same caveat as `get` applies, and additionally cares should be taken to avoid
|
|
|
|
/// The same caveat as `get` applies, and additionally cares should be taken to avoid
|
|
|
|
/// concurrent writes, but it's up to the caller to decide whether it's safe to dereference the
|
|
|
|
/// concurrent writes, but it's up to the caller to decide whether it's safe to dereference the
|
|
|
|
/// pointer or not.
|
|
|
|
/// pointer or not.
|
|
|
@ -74,11 +138,47 @@ impl<K, V> HashMap<K, V> {
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Inserts a key-value pair into the map.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::HashMap};
|
|
|
|
|
|
|
|
/// # use aya_bpf::programs::TracePointContext;
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// static PID_TO_TGID: HashMap<u32, u32> = HashMap::with_max_entries(1024, 0);
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # unsafe fn try_test(ctx: &LsmContext) -> Result<i32, i32> {
|
|
|
|
|
|
|
|
/// let pid: u32 = 13;
|
|
|
|
|
|
|
|
/// let tgid: u32 = 42;
|
|
|
|
|
|
|
|
/// PID_TO_TGID.insert(&pid, &tgid, 0).map_err(|e| e as i32)?;
|
|
|
|
|
|
|
|
/// # Ok(0)
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Removes a key-value pair from the map.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::HashMap};
|
|
|
|
|
|
|
|
/// # use aya_bpf::programs::TracePointContext;
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// PROCESSES: HashMap<u32, u32> = HashMap::with_max_entries(1024, 0);
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # fn try_test(ctx: &TracePointContext) -> Result<i32, i32> {
|
|
|
|
|
|
|
|
/// let pid: u32 = ctx.pid();
|
|
|
|
|
|
|
|
/// // Remove the currently exiting process from the map.
|
|
|
|
|
|
|
|
/// PROCESSES.remove(&pid).map_err(|e| e as i32)?;
|
|
|
|
|
|
|
|
/// # Ok(0)
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
remove(self.def.get(), key)
|
|
|
|
remove(self.def.get(), key)
|
|
|
@ -95,6 +195,7 @@ pub struct LruHashMap<K, V> {
|
|
|
|
unsafe impl<K: Sync, V: Sync> Sync for LruHashMap<K, V> {}
|
|
|
|
unsafe impl<K: Sync, V: Sync> Sync for LruHashMap<K, V> {}
|
|
|
|
|
|
|
|
|
|
|
|
impl<K, V> LruHashMap<K, V> {
|
|
|
|
impl<K, V> LruHashMap<K, V> {
|
|
|
|
|
|
|
|
/// Creates an `LruHashMap` with the maximum number of elements.
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> LruHashMap<K, V> {
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> LruHashMap<K, V> {
|
|
|
|
LruHashMap {
|
|
|
|
LruHashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -108,6 +209,8 @@ impl<K, V> LruHashMap<K, V> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Creates an `LruHashMap` pinned in the BPFFS filesystem, with the maximum
|
|
|
|
|
|
|
|
/// number of elements.
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> LruHashMap<K, V> {
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> LruHashMap<K, V> {
|
|
|
|
LruHashMap {
|
|
|
|
LruHashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -148,17 +251,45 @@ impl<K, V> LruHashMap<K, V> {
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mutable copy of the value associated with the key.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Inserts a key-value pair into the map.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
remove(self.def.get(), key)
|
|
|
|
remove(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A hash map that can be shared between eBPF programs and user space. Each
|
|
|
|
|
|
|
|
/// CPU has its own separate copy of the map. The copies are not synchronized
|
|
|
|
|
|
|
|
/// in any way.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Due to limits defined in the kernel, the `K` and `V` types cannot be larger
|
|
|
|
|
|
|
|
/// than 32KB in size.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Minimum kernel version
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// The minimum kernel version required to use this feature is 4.6.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Examples
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```no_run
|
|
|
|
|
|
|
|
/// use aya_bpf::{macros::map, maps::PerCpuHashMap};
|
|
|
|
|
|
|
|
/// # use aya_bpf::programs::LsmContext;
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// #[map]
|
|
|
|
|
|
|
|
/// static mut PID_COUNTER: PerCpuHashMap<u32, u32> = PerCpuHashMap::with_max_entries(1024, 0);
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # unsafe fn try_test(ctx: &LsmContext) -> Result<i32, i32> {
|
|
|
|
|
|
|
|
/// let pid = ctx.pid();
|
|
|
|
|
|
|
|
/// PID_COUNTER.insert(&key, &value, 0).map_err(|e| e as i32)?;
|
|
|
|
|
|
|
|
/// # Ok(0)
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
#[repr(transparent)]
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub struct PerCpuHashMap<K, V> {
|
|
|
|
pub struct PerCpuHashMap<K, V> {
|
|
|
|
def: UnsafeCell<bpf_map_def>,
|
|
|
|
def: UnsafeCell<bpf_map_def>,
|
|
|
@ -169,6 +300,7 @@ pub struct PerCpuHashMap<K, V> {
|
|
|
|
unsafe impl<K, V> Sync for PerCpuHashMap<K, V> {}
|
|
|
|
unsafe impl<K, V> Sync for PerCpuHashMap<K, V> {}
|
|
|
|
|
|
|
|
|
|
|
|
impl<K, V> PerCpuHashMap<K, V> {
|
|
|
|
impl<K, V> PerCpuHashMap<K, V> {
|
|
|
|
|
|
|
|
/// Creates a `PerCpuHashMap` with the maximum number of elements.
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> PerCpuHashMap<K, V> {
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> PerCpuHashMap<K, V> {
|
|
|
|
PerCpuHashMap {
|
|
|
|
PerCpuHashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -182,6 +314,8 @@ impl<K, V> PerCpuHashMap<K, V> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Creates a `PerCpuHashMap` pinned in the BPFFS filesystem, with the maximum
|
|
|
|
|
|
|
|
/// number of elements.
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> PerCpuHashMap<K, V> {
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> PerCpuHashMap<K, V> {
|
|
|
|
PerCpuHashMap {
|
|
|
|
PerCpuHashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -222,11 +356,13 @@ impl<K, V> PerCpuHashMap<K, V> {
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mutable copy of the value associated with the key.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Inserts a key-value pair into the map.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
remove(self.def.get(), key)
|
|
|
|
remove(self.def.get(), key)
|
|
|
@ -243,6 +379,7 @@ pub struct LruPerCpuHashMap<K, V> {
|
|
|
|
unsafe impl<K, V> Sync for LruPerCpuHashMap<K, V> {}
|
|
|
|
unsafe impl<K, V> Sync for LruPerCpuHashMap<K, V> {}
|
|
|
|
|
|
|
|
|
|
|
|
impl<K, V> LruPerCpuHashMap<K, V> {
|
|
|
|
impl<K, V> LruPerCpuHashMap<K, V> {
|
|
|
|
|
|
|
|
/// Creates an `LruPerCpuHashMap` with the maximum number of elements.
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> LruPerCpuHashMap<K, V> {
|
|
|
|
pub const fn with_max_entries(max_entries: u32, flags: u32) -> LruPerCpuHashMap<K, V> {
|
|
|
|
LruPerCpuHashMap {
|
|
|
|
LruPerCpuHashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -256,6 +393,8 @@ impl<K, V> LruPerCpuHashMap<K, V> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Creates an `LruPerCpuHashMap` pinned in the BPFFS filesystem, with the maximum
|
|
|
|
|
|
|
|
/// number of elements.
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> LruPerCpuHashMap<K, V> {
|
|
|
|
pub const fn pinned(max_entries: u32, flags: u32) -> LruPerCpuHashMap<K, V> {
|
|
|
|
LruPerCpuHashMap {
|
|
|
|
LruPerCpuHashMap {
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
|
def: UnsafeCell::new(build_def::<K, V>(
|
|
|
@ -296,11 +435,13 @@ impl<K, V> LruPerCpuHashMap<K, V> {
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
get_ptr_mut(self.def.get(), key)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mutable copy of the value associated with the key.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
pub fn insert(&self, key: &K, value: &V, flags: u64) -> Result<(), c_long> {
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
insert(self.def.get(), key, value, flags)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Inserts a key-value pair into the map.
|
|
|
|
#[inline]
|
|
|
|
#[inline]
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
pub fn remove(&self, key: &K) -> Result<(), c_long> {
|
|
|
|
remove(self.def.get(), key)
|
|
|
|
remove(self.def.get(), key)
|
|
|
|