// Auto-generated from BCH_BKEY_TYPES() — do not edit

impl c::bkey_i_deleted {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_whiteout {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_error {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_cookie {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_hash_whiteout {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_btree_ptr {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_extent {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_reservation {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_inode {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_inode_generation {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_dirent {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_xattr {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_alloc {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_quota {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_stripe {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_reflink_p {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_reflink_v {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_inline_data {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_btree_ptr_v2 {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_indirect_inline_data {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_alloc_v2 {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_subvolume {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_snapshot {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_inode_v2 {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_alloc_v3 {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_set {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_lru {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_alloc_v4 {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_backpointer {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_inode_v3 {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_bucket_gens {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_snapshot_tree {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_logged_op_truncate {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_logged_op_finsert {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_accounting {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_inode_alloc_cursor {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_extent_whiteout {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

impl c::bkey_i_logged_op_stripe_update {
    pub fn k(&self) -> &c::bkey { unsafe { self.__bindgen_anon_1.k.as_ref() } }
    pub fn k_mut(&mut self) -> &mut c::bkey { unsafe { self.__bindgen_anon_1.k.as_mut() } }
    pub fn k_i(&self) -> &c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_ref() } }
    pub fn k_i_mut(&mut self) -> &mut c::bkey_i { unsafe { self.__bindgen_anon_1.k_i.as_mut() } }
}

/// Typed dispatch for inline bkeys (`bkey_i`).
pub enum BkeyValI<'a> {
    deleted(&'a c::bkey_i_deleted),
    whiteout(&'a c::bkey_i_whiteout),
    error(&'a c::bkey_i_error),
    cookie(&'a c::bkey_i_cookie),
    hash_whiteout(&'a c::bkey_i_hash_whiteout),
    btree_ptr(&'a c::bkey_i_btree_ptr),
    extent(&'a c::bkey_i_extent),
    reservation(&'a c::bkey_i_reservation),
    inode(&'a c::bkey_i_inode),
    inode_generation(&'a c::bkey_i_inode_generation),
    dirent(&'a c::bkey_i_dirent),
    xattr(&'a c::bkey_i_xattr),
    alloc(&'a c::bkey_i_alloc),
    quota(&'a c::bkey_i_quota),
    stripe(&'a c::bkey_i_stripe),
    reflink_p(&'a c::bkey_i_reflink_p),
    reflink_v(&'a c::bkey_i_reflink_v),
    inline_data(&'a c::bkey_i_inline_data),
    btree_ptr_v2(&'a c::bkey_i_btree_ptr_v2),
    indirect_inline_data(&'a c::bkey_i_indirect_inline_data),
    alloc_v2(&'a c::bkey_i_alloc_v2),
    subvolume(&'a c::bkey_i_subvolume),
    snapshot(&'a c::bkey_i_snapshot),
    inode_v2(&'a c::bkey_i_inode_v2),
    alloc_v3(&'a c::bkey_i_alloc_v3),
    set(&'a c::bkey_i_set),
    lru(&'a c::bkey_i_lru),
    alloc_v4(&'a c::bkey_i_alloc_v4),
    backpointer(&'a c::bkey_i_backpointer),
    inode_v3(&'a c::bkey_i_inode_v3),
    bucket_gens(&'a c::bkey_i_bucket_gens),
    snapshot_tree(&'a c::bkey_i_snapshot_tree),
    logged_op_truncate(&'a c::bkey_i_logged_op_truncate),
    logged_op_finsert(&'a c::bkey_i_logged_op_finsert),
    accounting(&'a c::bkey_i_accounting),
    inode_alloc_cursor(&'a c::bkey_i_inode_alloc_cursor),
    extent_whiteout(&'a c::bkey_i_extent_whiteout),
    logged_op_stripe_update(&'a c::bkey_i_logged_op_stripe_update),
    unknown(&'a c::bkey_i),
}

impl<'a> BkeyValI<'a> {
    #[allow(clippy::missing_transmute_annotations)]
    pub fn from_bkey_i(k: &'a c::bkey_i) -> Self {
        match k.k.type_ as u32 {
            0 => BkeyValI::deleted(unsafe { std::mem::transmute(k) }),
            1 => BkeyValI::whiteout(unsafe { std::mem::transmute(k) }),
            2 => BkeyValI::error(unsafe { std::mem::transmute(k) }),
            3 => BkeyValI::cookie(unsafe { std::mem::transmute(k) }),
            4 => BkeyValI::hash_whiteout(unsafe { std::mem::transmute(k) }),
            5 => BkeyValI::btree_ptr(unsafe { std::mem::transmute(k) }),
            6 => BkeyValI::extent(unsafe { std::mem::transmute(k) }),
            7 => BkeyValI::reservation(unsafe { std::mem::transmute(k) }),
            8 => BkeyValI::inode(unsafe { std::mem::transmute(k) }),
            9 => BkeyValI::inode_generation(unsafe { std::mem::transmute(k) }),
            10 => BkeyValI::dirent(unsafe { std::mem::transmute(k) }),
            11 => BkeyValI::xattr(unsafe { std::mem::transmute(k) }),
            12 => BkeyValI::alloc(unsafe { std::mem::transmute(k) }),
            13 => BkeyValI::quota(unsafe { std::mem::transmute(k) }),
            14 => BkeyValI::stripe(unsafe { std::mem::transmute(k) }),
            15 => BkeyValI::reflink_p(unsafe { std::mem::transmute(k) }),
            16 => BkeyValI::reflink_v(unsafe { std::mem::transmute(k) }),
            17 => BkeyValI::inline_data(unsafe { std::mem::transmute(k) }),
            18 => BkeyValI::btree_ptr_v2(unsafe { std::mem::transmute(k) }),
            19 => BkeyValI::indirect_inline_data(unsafe { std::mem::transmute(k) }),
            20 => BkeyValI::alloc_v2(unsafe { std::mem::transmute(k) }),
            21 => BkeyValI::subvolume(unsafe { std::mem::transmute(k) }),
            22 => BkeyValI::snapshot(unsafe { std::mem::transmute(k) }),
            23 => BkeyValI::inode_v2(unsafe { std::mem::transmute(k) }),
            24 => BkeyValI::alloc_v3(unsafe { std::mem::transmute(k) }),
            25 => BkeyValI::set(unsafe { std::mem::transmute(k) }),
            26 => BkeyValI::lru(unsafe { std::mem::transmute(k) }),
            27 => BkeyValI::alloc_v4(unsafe { std::mem::transmute(k) }),
            28 => BkeyValI::backpointer(unsafe { std::mem::transmute(k) }),
            29 => BkeyValI::inode_v3(unsafe { std::mem::transmute(k) }),
            30 => BkeyValI::bucket_gens(unsafe { std::mem::transmute(k) }),
            31 => BkeyValI::snapshot_tree(unsafe { std::mem::transmute(k) }),
            32 => BkeyValI::logged_op_truncate(unsafe { std::mem::transmute(k) }),
            33 => BkeyValI::logged_op_finsert(unsafe { std::mem::transmute(k) }),
            34 => BkeyValI::accounting(unsafe { std::mem::transmute(k) }),
            35 => BkeyValI::inode_alloc_cursor(unsafe { std::mem::transmute(k) }),
            36 => BkeyValI::extent_whiteout(unsafe { std::mem::transmute(k) }),
            37 => BkeyValI::logged_op_stripe_update(unsafe { std::mem::transmute(k) }),
            _ => BkeyValI::unknown(k),
        }
    }
}

/// Typed dispatch for mutable inline bkeys (`bkey_i`).
pub enum BkeyValIMut<'a> {
    deleted(&'a mut c::bkey_i_deleted),
    whiteout(&'a mut c::bkey_i_whiteout),
    error(&'a mut c::bkey_i_error),
    cookie(&'a mut c::bkey_i_cookie),
    hash_whiteout(&'a mut c::bkey_i_hash_whiteout),
    btree_ptr(&'a mut c::bkey_i_btree_ptr),
    extent(&'a mut c::bkey_i_extent),
    reservation(&'a mut c::bkey_i_reservation),
    inode(&'a mut c::bkey_i_inode),
    inode_generation(&'a mut c::bkey_i_inode_generation),
    dirent(&'a mut c::bkey_i_dirent),
    xattr(&'a mut c::bkey_i_xattr),
    alloc(&'a mut c::bkey_i_alloc),
    quota(&'a mut c::bkey_i_quota),
    stripe(&'a mut c::bkey_i_stripe),
    reflink_p(&'a mut c::bkey_i_reflink_p),
    reflink_v(&'a mut c::bkey_i_reflink_v),
    inline_data(&'a mut c::bkey_i_inline_data),
    btree_ptr_v2(&'a mut c::bkey_i_btree_ptr_v2),
    indirect_inline_data(&'a mut c::bkey_i_indirect_inline_data),
    alloc_v2(&'a mut c::bkey_i_alloc_v2),
    subvolume(&'a mut c::bkey_i_subvolume),
    snapshot(&'a mut c::bkey_i_snapshot),
    inode_v2(&'a mut c::bkey_i_inode_v2),
    alloc_v3(&'a mut c::bkey_i_alloc_v3),
    set(&'a mut c::bkey_i_set),
    lru(&'a mut c::bkey_i_lru),
    alloc_v4(&'a mut c::bkey_i_alloc_v4),
    backpointer(&'a mut c::bkey_i_backpointer),
    inode_v3(&'a mut c::bkey_i_inode_v3),
    bucket_gens(&'a mut c::bkey_i_bucket_gens),
    snapshot_tree(&'a mut c::bkey_i_snapshot_tree),
    logged_op_truncate(&'a mut c::bkey_i_logged_op_truncate),
    logged_op_finsert(&'a mut c::bkey_i_logged_op_finsert),
    accounting(&'a mut c::bkey_i_accounting),
    inode_alloc_cursor(&'a mut c::bkey_i_inode_alloc_cursor),
    extent_whiteout(&'a mut c::bkey_i_extent_whiteout),
    logged_op_stripe_update(&'a mut c::bkey_i_logged_op_stripe_update),
    unknown(&'a mut c::bkey_i),
}

impl<'a> BkeyValIMut<'a> {
    #[allow(clippy::missing_transmute_annotations)]
    pub fn from_bkey_i(k: &'a mut c::bkey_i) -> Self {
        let type_ = k.k.type_;
        match type_ as u32 {
            0 => BkeyValIMut::deleted(unsafe { std::mem::transmute(k) }),
            1 => BkeyValIMut::whiteout(unsafe { std::mem::transmute(k) }),
            2 => BkeyValIMut::error(unsafe { std::mem::transmute(k) }),
            3 => BkeyValIMut::cookie(unsafe { std::mem::transmute(k) }),
            4 => BkeyValIMut::hash_whiteout(unsafe { std::mem::transmute(k) }),
            5 => BkeyValIMut::btree_ptr(unsafe { std::mem::transmute(k) }),
            6 => BkeyValIMut::extent(unsafe { std::mem::transmute(k) }),
            7 => BkeyValIMut::reservation(unsafe { std::mem::transmute(k) }),
            8 => BkeyValIMut::inode(unsafe { std::mem::transmute(k) }),
            9 => BkeyValIMut::inode_generation(unsafe { std::mem::transmute(k) }),
            10 => BkeyValIMut::dirent(unsafe { std::mem::transmute(k) }),
            11 => BkeyValIMut::xattr(unsafe { std::mem::transmute(k) }),
            12 => BkeyValIMut::alloc(unsafe { std::mem::transmute(k) }),
            13 => BkeyValIMut::quota(unsafe { std::mem::transmute(k) }),
            14 => BkeyValIMut::stripe(unsafe { std::mem::transmute(k) }),
            15 => BkeyValIMut::reflink_p(unsafe { std::mem::transmute(k) }),
            16 => BkeyValIMut::reflink_v(unsafe { std::mem::transmute(k) }),
            17 => BkeyValIMut::inline_data(unsafe { std::mem::transmute(k) }),
            18 => BkeyValIMut::btree_ptr_v2(unsafe { std::mem::transmute(k) }),
            19 => BkeyValIMut::indirect_inline_data(unsafe { std::mem::transmute(k) }),
            20 => BkeyValIMut::alloc_v2(unsafe { std::mem::transmute(k) }),
            21 => BkeyValIMut::subvolume(unsafe { std::mem::transmute(k) }),
            22 => BkeyValIMut::snapshot(unsafe { std::mem::transmute(k) }),
            23 => BkeyValIMut::inode_v2(unsafe { std::mem::transmute(k) }),
            24 => BkeyValIMut::alloc_v3(unsafe { std::mem::transmute(k) }),
            25 => BkeyValIMut::set(unsafe { std::mem::transmute(k) }),
            26 => BkeyValIMut::lru(unsafe { std::mem::transmute(k) }),
            27 => BkeyValIMut::alloc_v4(unsafe { std::mem::transmute(k) }),
            28 => BkeyValIMut::backpointer(unsafe { std::mem::transmute(k) }),
            29 => BkeyValIMut::inode_v3(unsafe { std::mem::transmute(k) }),
            30 => BkeyValIMut::bucket_gens(unsafe { std::mem::transmute(k) }),
            31 => BkeyValIMut::snapshot_tree(unsafe { std::mem::transmute(k) }),
            32 => BkeyValIMut::logged_op_truncate(unsafe { std::mem::transmute(k) }),
            33 => BkeyValIMut::logged_op_finsert(unsafe { std::mem::transmute(k) }),
            34 => BkeyValIMut::accounting(unsafe { std::mem::transmute(k) }),
            35 => BkeyValIMut::inode_alloc_cursor(unsafe { std::mem::transmute(k) }),
            36 => BkeyValIMut::extent_whiteout(unsafe { std::mem::transmute(k) }),
            37 => BkeyValIMut::logged_op_stripe_update(unsafe { std::mem::transmute(k) }),
            _ => BkeyValIMut::unknown(k),
        }
    }
}

/// Typed dispatch for split-const bkey references.
pub enum BkeyValSC<'a> {
    deleted(&'a c::bkey, &'a c::bch_deleted),
    whiteout(&'a c::bkey, &'a c::bch_whiteout),
    error(&'a c::bkey, &'a c::bch_error),
    cookie(&'a c::bkey, &'a c::bch_cookie),
    hash_whiteout(&'a c::bkey, &'a c::bch_hash_whiteout),
    btree_ptr(&'a c::bkey, &'a c::bch_btree_ptr),
    extent(&'a c::bkey, &'a c::bch_extent),
    reservation(&'a c::bkey, &'a c::bch_reservation),
    inode(&'a c::bkey, &'a c::bch_inode),
    inode_generation(&'a c::bkey, &'a c::bch_inode_generation),
    dirent(&'a c::bkey, &'a c::bch_dirent),
    xattr(&'a c::bkey, &'a c::bch_xattr),
    alloc(&'a c::bkey, &'a c::bch_alloc),
    quota(&'a c::bkey, &'a c::bch_quota),
    stripe(&'a c::bkey, &'a c::bch_stripe),
    reflink_p(&'a c::bkey, &'a c::bch_reflink_p),
    reflink_v(&'a c::bkey, &'a c::bch_reflink_v),
    inline_data(&'a c::bkey, &'a c::bch_inline_data),
    btree_ptr_v2(&'a c::bkey, &'a c::bch_btree_ptr_v2),
    indirect_inline_data(&'a c::bkey, &'a c::bch_indirect_inline_data),
    alloc_v2(&'a c::bkey, &'a c::bch_alloc_v2),
    subvolume(&'a c::bkey, &'a c::bch_subvolume),
    snapshot(&'a c::bkey, &'a c::bch_snapshot),
    inode_v2(&'a c::bkey, &'a c::bch_inode_v2),
    alloc_v3(&'a c::bkey, &'a c::bch_alloc_v3),
    set(&'a c::bkey, &'a c::bch_set),
    lru(&'a c::bkey, &'a c::bch_lru),
    alloc_v4(&'a c::bkey, &'a c::bch_alloc_v4),
    backpointer(&'a c::bkey, &'a c::bch_backpointer),
    inode_v3(&'a c::bkey, &'a c::bch_inode_v3),
    bucket_gens(&'a c::bkey, &'a c::bch_bucket_gens),
    snapshot_tree(&'a c::bkey, &'a c::bch_snapshot_tree),
    logged_op_truncate(&'a c::bkey, &'a c::bch_logged_op_truncate),
    logged_op_finsert(&'a c::bkey, &'a c::bch_logged_op_finsert),
    accounting(&'a c::bkey, &'a c::bch_accounting),
    inode_alloc_cursor(&'a c::bkey, &'a c::bch_inode_alloc_cursor),
    extent_whiteout(&'a c::bkey, &'a c::bch_extent_whiteout),
    logged_op_stripe_update(&'a c::bkey, &'a c::bch_logged_op_stripe_update),
    unknown(&'a c::bkey, u8),
}

impl<'a> BkeyValSC<'a> {
    #[allow(clippy::missing_transmute_annotations)]
    pub fn from_bkey_i(k: &'a c::bkey_i) -> Self {
        match k.k.type_ as u32 {
            0 => BkeyValSC::deleted(&k.k, unsafe { std::mem::transmute(&k.v) }),
            1 => BkeyValSC::whiteout(&k.k, unsafe { std::mem::transmute(&k.v) }),
            2 => BkeyValSC::error(&k.k, unsafe { std::mem::transmute(&k.v) }),
            3 => BkeyValSC::cookie(&k.k, unsafe { std::mem::transmute(&k.v) }),
            4 => BkeyValSC::hash_whiteout(&k.k, unsafe { std::mem::transmute(&k.v) }),
            5 => BkeyValSC::btree_ptr(&k.k, unsafe { std::mem::transmute(&k.v) }),
            6 => BkeyValSC::extent(&k.k, unsafe { std::mem::transmute(&k.v) }),
            7 => BkeyValSC::reservation(&k.k, unsafe { std::mem::transmute(&k.v) }),
            8 => BkeyValSC::inode(&k.k, unsafe { std::mem::transmute(&k.v) }),
            9 => BkeyValSC::inode_generation(&k.k, unsafe { std::mem::transmute(&k.v) }),
            10 => BkeyValSC::dirent(&k.k, unsafe { std::mem::transmute(&k.v) }),
            11 => BkeyValSC::xattr(&k.k, unsafe { std::mem::transmute(&k.v) }),
            12 => BkeyValSC::alloc(&k.k, unsafe { std::mem::transmute(&k.v) }),
            13 => BkeyValSC::quota(&k.k, unsafe { std::mem::transmute(&k.v) }),
            14 => BkeyValSC::stripe(&k.k, unsafe { std::mem::transmute(&k.v) }),
            15 => BkeyValSC::reflink_p(&k.k, unsafe { std::mem::transmute(&k.v) }),
            16 => BkeyValSC::reflink_v(&k.k, unsafe { std::mem::transmute(&k.v) }),
            17 => BkeyValSC::inline_data(&k.k, unsafe { std::mem::transmute(&k.v) }),
            18 => BkeyValSC::btree_ptr_v2(&k.k, unsafe { std::mem::transmute(&k.v) }),
            19 => BkeyValSC::indirect_inline_data(&k.k, unsafe { std::mem::transmute(&k.v) }),
            20 => BkeyValSC::alloc_v2(&k.k, unsafe { std::mem::transmute(&k.v) }),
            21 => BkeyValSC::subvolume(&k.k, unsafe { std::mem::transmute(&k.v) }),
            22 => BkeyValSC::snapshot(&k.k, unsafe { std::mem::transmute(&k.v) }),
            23 => BkeyValSC::inode_v2(&k.k, unsafe { std::mem::transmute(&k.v) }),
            24 => BkeyValSC::alloc_v3(&k.k, unsafe { std::mem::transmute(&k.v) }),
            25 => BkeyValSC::set(&k.k, unsafe { std::mem::transmute(&k.v) }),
            26 => BkeyValSC::lru(&k.k, unsafe { std::mem::transmute(&k.v) }),
            27 => BkeyValSC::alloc_v4(&k.k, unsafe { std::mem::transmute(&k.v) }),
            28 => BkeyValSC::backpointer(&k.k, unsafe { std::mem::transmute(&k.v) }),
            29 => BkeyValSC::inode_v3(&k.k, unsafe { std::mem::transmute(&k.v) }),
            30 => BkeyValSC::bucket_gens(&k.k, unsafe { std::mem::transmute(&k.v) }),
            31 => BkeyValSC::snapshot_tree(&k.k, unsafe { std::mem::transmute(&k.v) }),
            32 => BkeyValSC::logged_op_truncate(&k.k, unsafe { std::mem::transmute(&k.v) }),
            33 => BkeyValSC::logged_op_finsert(&k.k, unsafe { std::mem::transmute(&k.v) }),
            34 => BkeyValSC::accounting(&k.k, unsafe { std::mem::transmute(&k.v) }),
            35 => BkeyValSC::inode_alloc_cursor(&k.k, unsafe { std::mem::transmute(&k.v) }),
            36 => BkeyValSC::extent_whiteout(&k.k, unsafe { std::mem::transmute(&k.v) }),
            37 => BkeyValSC::logged_op_stripe_update(&k.k, unsafe { std::mem::transmute(&k.v) }),
            _ => BkeyValSC::unknown(&k.k, k.k.type_),
        }
    }

    /// Construct from raw key and value references.
    ///
    /// # Safety
    /// `val` must point to valid data for the bkey type indicated by `k.type_`.
    #[allow(clippy::missing_transmute_annotations)]
    pub unsafe fn from_raw(k: &'a c::bkey, val: &'a c::bch_val) -> Self {
        match k.type_ as u32 {
            0 => BkeyValSC::deleted(k, std::mem::transmute(val)),
            1 => BkeyValSC::whiteout(k, std::mem::transmute(val)),
            2 => BkeyValSC::error(k, std::mem::transmute(val)),
            3 => BkeyValSC::cookie(k, std::mem::transmute(val)),
            4 => BkeyValSC::hash_whiteout(k, std::mem::transmute(val)),
            5 => BkeyValSC::btree_ptr(k, std::mem::transmute(val)),
            6 => BkeyValSC::extent(k, std::mem::transmute(val)),
            7 => BkeyValSC::reservation(k, std::mem::transmute(val)),
            8 => BkeyValSC::inode(k, std::mem::transmute(val)),
            9 => BkeyValSC::inode_generation(k, std::mem::transmute(val)),
            10 => BkeyValSC::dirent(k, std::mem::transmute(val)),
            11 => BkeyValSC::xattr(k, std::mem::transmute(val)),
            12 => BkeyValSC::alloc(k, std::mem::transmute(val)),
            13 => BkeyValSC::quota(k, std::mem::transmute(val)),
            14 => BkeyValSC::stripe(k, std::mem::transmute(val)),
            15 => BkeyValSC::reflink_p(k, std::mem::transmute(val)),
            16 => BkeyValSC::reflink_v(k, std::mem::transmute(val)),
            17 => BkeyValSC::inline_data(k, std::mem::transmute(val)),
            18 => BkeyValSC::btree_ptr_v2(k, std::mem::transmute(val)),
            19 => BkeyValSC::indirect_inline_data(k, std::mem::transmute(val)),
            20 => BkeyValSC::alloc_v2(k, std::mem::transmute(val)),
            21 => BkeyValSC::subvolume(k, std::mem::transmute(val)),
            22 => BkeyValSC::snapshot(k, std::mem::transmute(val)),
            23 => BkeyValSC::inode_v2(k, std::mem::transmute(val)),
            24 => BkeyValSC::alloc_v3(k, std::mem::transmute(val)),
            25 => BkeyValSC::set(k, std::mem::transmute(val)),
            26 => BkeyValSC::lru(k, std::mem::transmute(val)),
            27 => BkeyValSC::alloc_v4(k, std::mem::transmute(val)),
            28 => BkeyValSC::backpointer(k, std::mem::transmute(val)),
            29 => BkeyValSC::inode_v3(k, std::mem::transmute(val)),
            30 => BkeyValSC::bucket_gens(k, std::mem::transmute(val)),
            31 => BkeyValSC::snapshot_tree(k, std::mem::transmute(val)),
            32 => BkeyValSC::logged_op_truncate(k, std::mem::transmute(val)),
            33 => BkeyValSC::logged_op_finsert(k, std::mem::transmute(val)),
            34 => BkeyValSC::accounting(k, std::mem::transmute(val)),
            35 => BkeyValSC::inode_alloc_cursor(k, std::mem::transmute(val)),
            36 => BkeyValSC::extent_whiteout(k, std::mem::transmute(val)),
            37 => BkeyValSC::logged_op_stripe_update(k, std::mem::transmute(val)),
            _ => BkeyValSC::unknown(k, k.type_),
        }
    }
}

/// Typed dispatch for split-mutable bkey references.
pub enum BkeyValS<'a> {
    deleted(&'a mut c::bkey, &'a mut c::bch_deleted),
    whiteout(&'a mut c::bkey, &'a mut c::bch_whiteout),
    error(&'a mut c::bkey, &'a mut c::bch_error),
    cookie(&'a mut c::bkey, &'a mut c::bch_cookie),
    hash_whiteout(&'a mut c::bkey, &'a mut c::bch_hash_whiteout),
    btree_ptr(&'a mut c::bkey, &'a mut c::bch_btree_ptr),
    extent(&'a mut c::bkey, &'a mut c::bch_extent),
    reservation(&'a mut c::bkey, &'a mut c::bch_reservation),
    inode(&'a mut c::bkey, &'a mut c::bch_inode),
    inode_generation(&'a mut c::bkey, &'a mut c::bch_inode_generation),
    dirent(&'a mut c::bkey, &'a mut c::bch_dirent),
    xattr(&'a mut c::bkey, &'a mut c::bch_xattr),
    alloc(&'a mut c::bkey, &'a mut c::bch_alloc),
    quota(&'a mut c::bkey, &'a mut c::bch_quota),
    stripe(&'a mut c::bkey, &'a mut c::bch_stripe),
    reflink_p(&'a mut c::bkey, &'a mut c::bch_reflink_p),
    reflink_v(&'a mut c::bkey, &'a mut c::bch_reflink_v),
    inline_data(&'a mut c::bkey, &'a mut c::bch_inline_data),
    btree_ptr_v2(&'a mut c::bkey, &'a mut c::bch_btree_ptr_v2),
    indirect_inline_data(&'a mut c::bkey, &'a mut c::bch_indirect_inline_data),
    alloc_v2(&'a mut c::bkey, &'a mut c::bch_alloc_v2),
    subvolume(&'a mut c::bkey, &'a mut c::bch_subvolume),
    snapshot(&'a mut c::bkey, &'a mut c::bch_snapshot),
    inode_v2(&'a mut c::bkey, &'a mut c::bch_inode_v2),
    alloc_v3(&'a mut c::bkey, &'a mut c::bch_alloc_v3),
    set(&'a mut c::bkey, &'a mut c::bch_set),
    lru(&'a mut c::bkey, &'a mut c::bch_lru),
    alloc_v4(&'a mut c::bkey, &'a mut c::bch_alloc_v4),
    backpointer(&'a mut c::bkey, &'a mut c::bch_backpointer),
    inode_v3(&'a mut c::bkey, &'a mut c::bch_inode_v3),
    bucket_gens(&'a mut c::bkey, &'a mut c::bch_bucket_gens),
    snapshot_tree(&'a mut c::bkey, &'a mut c::bch_snapshot_tree),
    logged_op_truncate(&'a mut c::bkey, &'a mut c::bch_logged_op_truncate),
    logged_op_finsert(&'a mut c::bkey, &'a mut c::bch_logged_op_finsert),
    accounting(&'a mut c::bkey, &'a mut c::bch_accounting),
    inode_alloc_cursor(&'a mut c::bkey, &'a mut c::bch_inode_alloc_cursor),
    extent_whiteout(&'a mut c::bkey, &'a mut c::bch_extent_whiteout),
    logged_op_stripe_update(&'a mut c::bkey, &'a mut c::bch_logged_op_stripe_update),
    unknown(&'a mut c::bkey, u8),
}

impl<'a> BkeyValS<'a> {
    #[allow(clippy::missing_transmute_annotations)]
    pub fn from_bkey_i(k: &'a mut c::bkey_i) -> Self {
        let type_ = k.k.type_;
        match type_ as u32 {
            0 => BkeyValS::deleted(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            1 => BkeyValS::whiteout(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            2 => BkeyValS::error(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            3 => BkeyValS::cookie(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            4 => BkeyValS::hash_whiteout(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            5 => BkeyValS::btree_ptr(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            6 => BkeyValS::extent(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            7 => BkeyValS::reservation(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            8 => BkeyValS::inode(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            9 => BkeyValS::inode_generation(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            10 => BkeyValS::dirent(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            11 => BkeyValS::xattr(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            12 => BkeyValS::alloc(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            13 => BkeyValS::quota(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            14 => BkeyValS::stripe(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            15 => BkeyValS::reflink_p(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            16 => BkeyValS::reflink_v(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            17 => BkeyValS::inline_data(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            18 => BkeyValS::btree_ptr_v2(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            19 => BkeyValS::indirect_inline_data(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            20 => BkeyValS::alloc_v2(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            21 => BkeyValS::subvolume(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            22 => BkeyValS::snapshot(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            23 => BkeyValS::inode_v2(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            24 => BkeyValS::alloc_v3(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            25 => BkeyValS::set(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            26 => BkeyValS::lru(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            27 => BkeyValS::alloc_v4(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            28 => BkeyValS::backpointer(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            29 => BkeyValS::inode_v3(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            30 => BkeyValS::bucket_gens(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            31 => BkeyValS::snapshot_tree(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            32 => BkeyValS::logged_op_truncate(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            33 => BkeyValS::logged_op_finsert(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            34 => BkeyValS::accounting(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            35 => BkeyValS::inode_alloc_cursor(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            36 => BkeyValS::extent_whiteout(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            37 => BkeyValS::logged_op_stripe_update(&mut k.k, unsafe { std::mem::transmute(&mut k.v) }),
            _ => BkeyValS::unknown(&mut k.k, type_),
        }
    }
}
