rust/hg-core/src/revlog/index.rs
changeset 51700 7f0cb9ee0534
parent 51693 918ceb5a3d25
child 51707 ec7171748350
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
  1385     /// and having constant capacity typically can have a very simple
  1385     /// and having constant capacity typically can have a very simple
  1386     /// implementation.
  1386     /// implementation.
  1387     fn vec_of_empty(sets_size: usize, vec_len: usize) -> Vec<Self>;
  1387     fn vec_of_empty(sets_size: usize, vec_len: usize) -> Vec<Self>;
  1388 
  1388 
  1389     /// The size of the bit mask in memory
  1389     /// The size of the bit mask in memory
  1390     #[allow(unused)]
       
  1391     fn size(&self) -> usize;
  1390     fn size(&self) -> usize;
  1392 
  1391 
  1393     /// The number of elements that can be represented in the set.
  1392     /// The number of elements that can be represented in the set.
  1394     ///
  1393     ///
  1395     /// Another way to put it is that it is the highest integer `C` such that
  1394     /// Another way to put it is that it is the highest integer `C` such that
  1396     /// the set is guaranteed to always be a subset of the integer range
  1395     /// the set is guaranteed to always be a subset of the integer range
  1397     /// `[0, C)`
  1396     /// `[0, C)`
  1398     #[allow(unused)]
       
  1399     fn capacity(&self) -> usize;
  1397     fn capacity(&self) -> usize;
  1400 
  1398 
  1401     /// Declare `n` to belong to the set
  1399     /// Declare `n` to belong to the set
  1402     fn add(&mut self, n: usize);
  1400     fn add(&mut self, n: usize);
  1403 
  1401 
  1404     /// Declare `n` not to belong to the set
  1402     /// Declare `n` not to belong to the set
  1405     #[allow(unused)]
       
  1406     fn discard(&mut self, n: usize);
  1403     fn discard(&mut self, n: usize);
  1407 
  1404 
  1408     /// Replace this bit set by its union with other
  1405     /// Replace this bit set by its union with other
  1409     fn union(&mut self, other: &Self);
  1406     fn union(&mut self, other: &Self);
  1410 
  1407 
  1748 
  1745 
  1749     pub fn as_bytes(&self) -> &'a [u8] {
  1746     pub fn as_bytes(&self) -> &'a [u8] {
  1750         self.bytes
  1747         self.bytes
  1751     }
  1748     }
  1752 }
  1749 }
  1753 
       
  1754 #[cfg(test)]
       
  1755 pub use tests::IndexEntryBuilder;
       
  1756 
  1750 
  1757 #[cfg(test)]
  1751 #[cfg(test)]
  1758 mod tests {
  1752 mod tests {
  1759     use super::*;
  1753     use super::*;
  1760     use crate::node::NULL_NODE;
  1754     use crate::node::NULL_NODE;
  2031             .build();
  2025             .build();
  2032 
  2026 
  2033         assert_eq!(get_version(&bytes), 2)
  2027         assert_eq!(get_version(&bytes), 2)
  2034     }
  2028     }
  2035 }
  2029 }
       
  2030 
       
  2031 #[cfg(test)]
       
  2032 pub use tests::IndexEntryBuilder;