Add impl for Copy and Clone for Key struct

pull/129/head
Ubuntu 3 years ago
parent a725ae4f8b
commit fe22203e3a

@ -32,7 +32,6 @@ pub struct LpmTrie<T: Deref<Target = Map>, K, V> {
_v: PhantomData<V>, _v: PhantomData<V>,
} }
#[derive(Clone, Copy)]
#[repr(packed)] #[repr(packed)]
pub struct Key<K: Pod> { pub struct Key<K: Pod> {
pub key_base: bpf_lpm_trie_key, pub key_base: bpf_lpm_trie_key,
@ -51,6 +50,14 @@ impl<K: Pod> Key<K> {
} }
} }
impl<K:Pod> Copy for Key<K> { }
impl<K:Pod> Clone for Key<K> {
fn clone(&self) -> Self {
*self
}
}
// A Pod impl is required as bpf_lpm_trie_key is a key for a map. // A Pod impl is required as bpf_lpm_trie_key is a key for a map.
unsafe impl<K: Pod> Pod for Key<K> {} unsafe impl<K: Pod> Pod for Key<K> {}

Loading…
Cancel
Save