use crate::macros::{bits_enum, for_current_bitness};
use crate::tag_type::TagType;
use crate::Root;
type SliceRef<'a, T> = &'a [T];
#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Copy)]
pub struct DisjointSetRoView<'a>(pub(crate) bits_enum!(SliceRef, 'a));
#[allow(clippy::len_without_is_empty)]
impl DisjointSetRoView<'_> {
#[inline]
#[must_use]
pub fn len(&self) -> usize {
for_current_bitness!(self.0;arr;arr.len())
}
#[must_use]
#[inline]
pub fn get_root(&self, idx: usize) -> Root {
let root = for_current_bitness!(self.0;a;a[idx].as_u());
Root(root)
}
#[must_use]
#[inline]
pub fn is_united(&self, idx0: usize, idx1: usize) -> bool {
idx0 == idx1 || self.get_root(idx0) == self.get_root(idx1)
}
}