Skip to content

Commit

Permalink
doc: mark internals properly
Browse files Browse the repository at this point in the history
  • Loading branch information
chrjabs committed Jun 12, 2024
1 parent e1a4253 commit 0608be4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/encodings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ mod nodedbimpl;
// Module defined inline to be able to dynamically change visibility
// (non-inline modules in proc macro input are unstable)
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
mod nodedb {
//! # Node Database Functionality For Universal Tree-Like Encodings
//!
Expand Down
1 change: 1 addition & 0 deletions src/encodings/card/dbtotalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ impl LitData {
/// A totalizer database
#[derive(Default, Clone)]
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
pub(in crate::encodings) struct TotDb {
/// The node database of the totalizer
nodes: Vec<Node>,
Expand Down
3 changes: 3 additions & 0 deletions src/encodings/card/totalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl Totalizer {
/// Recursively builds the tree data structure. Attention, low level
/// interface, might change!
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
#[must_use]
fn build_tree(lits: &[Lit]) -> Node {
debug_assert_ne!(lits.len(), 0);
Expand Down Expand Up @@ -94,6 +95,7 @@ impl Totalizer {

/// Fully builds the tree, then returns it
#[cfg(feature = "internals")]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
#[must_use]
pub fn tree(mut self) -> Option<Node> {
self.extend_tree();
Expand Down Expand Up @@ -339,6 +341,7 @@ pub(super) type TotIter<'a> = std::iter::Copied<std::slice::Iter<'a, Lit>>;
/// more complex encodings, for using the totalizer, this should not be directly
/// accessed but only through [`Totalizer`].
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
enum Node {
/// An input literal, i.e., a leaf node of the tree
Leaf {
Expand Down
7 changes: 7 additions & 0 deletions src/encodings/pb/dpw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ impl DynamicPolyWatchdog {

/// Type containing information about the DPW encoding structure
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
#[derive(Clone)]
pub(crate) struct Structure {
/// The bottom buckets of the encoding. The first one of them is the root of the encoding.
Expand Down Expand Up @@ -647,6 +648,7 @@ type DpwIter<'a> = std::iter::Map<

/// Builds a DPW [`Structure`] over weighted input literals
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
fn lit_weight_queue<LI: Iterator<Item = (Lit, usize)>>(lits: LI, tot_db: &mut TotDb) -> WeightQ {
let lit_to_con = |(lit, weight)| {
let node = tot_db.insert(Node::leaf(lit));
Expand All @@ -661,6 +663,7 @@ fn lit_weight_queue<LI: Iterator<Item = (Lit, usize)>>(lits: LI, tot_db: &mut To
///
/// If `cons` is empty
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
fn con_weight_queue<CI: Iterator<Item = NodeCon>>(cons: CI) -> WeightQ {
let mut weight_queue: WeightQ = BTreeMap::new();
for con in cons {
Expand Down Expand Up @@ -688,6 +691,7 @@ fn con_weight_queue<CI: Iterator<Item = NodeCon>>(cons: CI) -> WeightQ {
///
/// - If `weight_queue` is empty
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
fn build_structure(
weight_queue: &mut WeightQ,
prec_div: usize,
Expand Down Expand Up @@ -818,6 +822,7 @@ fn build_structure(
/// - If `bot_struct` has no bottom buckets
#[allow(clippy::too_many_lines)]
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
fn merge_structures<Col>(
bot_struct: &mut Structure,
top_struct: Structure,
Expand Down Expand Up @@ -964,6 +969,7 @@ where
///
/// If the clause collector runs out of memory, returns [`crate::OutOfMemory`]
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
fn encode_output<Col>(
dpw: &Structure,
oidx: usize,
Expand All @@ -987,6 +993,7 @@ where
///
/// If `dpw` is not adequately encoded, returns [`Error::NotEncoded`].
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
fn enforce_ub(dpw: &Structure, ub: usize, tot_db: &TotDb) -> Result<Vec<Lit>, Error> {
let output_weight = 1 << (dpw.output_power());
let oidx = ub / output_weight;
Expand Down
1 change: 1 addition & 0 deletions src/encodings/pb/gte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ impl Extend<(Lit, usize)> for GeneralizedTotalizer {
/// literals happens in the [`GeneralizedTotalizer`] or
/// [`super::InvertedGeneralizedTotalizer`] structs.
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
enum Node {
/// A weighted input literal, i.e., a leaf node of the tree
Leaf {
Expand Down
1 change: 1 addition & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
///
/// If `basis` is `1` and `number` is larger than `u32`.
#[cfg_attr(feature = "internals", visibility::make(pub))]
#[cfg_attr(docsrs, doc(cfg(feature = "internals")))]
#[must_use]
pub(crate) fn digits(mut number: usize, mut basis: u8) -> u32 {
debug_assert_ne!(basis, 0);
Expand Down

0 comments on commit 0608be4

Please sign in to comment.