Skip to content

Commit 951c479

Browse files
committed
refactor: gate bitvec sql methods
1 parent 35f2401 commit 951c479

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

stacks-common/src/bitvec.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17+
#[cfg(feature = "canonical")]
1718
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSqlOutput, ValueRef};
19+
#[cfg(feature = "canonical")]
1820
use rusqlite::ToSql;
1921
use serde::{Deserialize, Serialize};
2022

@@ -106,6 +108,7 @@ impl<'de, const MAX_SIZE: u16> Deserialize<'de> for BitVec<MAX_SIZE> {
106108
}
107109
}
108110

111+
#[cfg(feature = "canonical")]
109112
impl<const MAX_SIZE: u16> FromSql for BitVec<MAX_SIZE> {
110113
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
111114
let bytes = hex_bytes(value.as_str()?).map_err(|e| FromSqlError::Other(Box::new(e)))?;
@@ -114,6 +117,7 @@ impl<const MAX_SIZE: u16> FromSql for BitVec<MAX_SIZE> {
114117
}
115118
}
116119

120+
#[cfg(feature = "canonical")]
117121
impl<const MAX_SIZE: u16> ToSql for BitVec<MAX_SIZE> {
118122
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
119123
let hex = bytes_to_hex(self.serialize_to_vec().as_slice());

stacks-common/src/libcommon.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ pub mod address;
3131

3232
pub mod deps_common;
3333

34-
#[cfg(feature = "canonical")]
3534
pub mod bitvec;
3635

3736
use crate::types::chainstate::{BlockHeaderHash, BurnchainHeaderHash, SortitionId, StacksBlockId};

0 commit comments

Comments
 (0)