Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ readme = "README.md"
keywords = ["unification", "union-find"]

[features]
std = [ ]
bench = [ ]
persistent = [ "dogged" ]
persistent = [ "std", "dogged" ]

[dependencies]
dogged = { version = "0.2.0", optional = true }
log = "0.4"
log = { version = "0.4", optional = true }
301 changes: 0 additions & 301 deletions src/bitvec.rs

This file was deleted.

7 changes: 6 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@

//! An implementation of union-find. See the `unify` module for more
//! details.

#![cfg_attr(feature = "bench", feature(test))]
#![cfg_attr(not(feature = "std"), no_std)]

#[cfg(feature = "std")]
extern crate core;
extern crate alloc;

#[cfg(feature = "log")]
#[macro_use]
extern crate log;

Expand Down
9 changes: 5 additions & 4 deletions src/snapshot_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@

use self::UndoLog::*;

use std::fmt;
use std::marker::PhantomData;
use std::mem;
use std::ops;
use core::fmt;
use core::marker::PhantomData;
use core::mem;
use core::ops;
use alloc::vec::Vec;

use undo_log::{Rollback, Snapshots, UndoLogs, VecLog};

Expand Down
7 changes: 6 additions & 1 deletion src/undo_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
//! Since the `*Storage` variants do not have an undo log `with_log` must be called with the
//! unified log before any mutating actions.

use core::ops;
use alloc::vec::Vec;

/// A trait which allows undo actions (`T`) to be pushed which can be used to rollback actio at a
/// later time if needed.
///
Expand Down Expand Up @@ -181,6 +184,7 @@ impl<T> Snapshots<T> for VecLog<T> {
where
R: Rollback<T>,
{
#[cfg(feature = "log")]
debug!("rollback_to({})", snapshot.undo_len);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a custom debug macro that does the cfg?
like

macro_rules! debug {
  ($($tt:tt)*) => {
    #[cfg(feature = "log")]
    log::debug!($($tt)*);
  };
}

}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in a0fb25d and e32df28


self.assert_open_snapshot(&snapshot);
Expand All @@ -196,6 +200,7 @@ impl<T> Snapshots<T> for VecLog<T> {
}

fn commit(&mut self, snapshot: Snapshot) {
#[cfg(feature = "log")]
debug!("commit({})", snapshot.undo_len);

self.assert_open_snapshot(&snapshot);
Expand All @@ -220,7 +225,7 @@ impl<T> VecLog<T> {
}
}

impl<T> std::ops::Index<usize> for VecLog<T> {
impl<T> ops::Index<usize> for VecLog<T> {
type Output = T;
fn index(&self, key: usize) -> &T {
&self.log[key]
Expand Down
5 changes: 3 additions & 2 deletions src/unify/backing_vec.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[cfg(feature = "persistent")]
use dogged::DVec;
use snapshot_vec as sv;
use std::marker::PhantomData;
use std::ops::{self, Range};
use core::marker::PhantomData;
use core::ops::{self, Range};
use alloc::vec::Vec;

use undo_log::{Rollback, Snapshots, UndoLogs, VecLog};

Expand Down
Loading