Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
danlehmann committed Jul 23, 2024
1 parent c99730e commit aef2d34
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ use core::ops::{
#[cfg(feature = "serde")]
use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[cfg(feature = "borsh")]
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};

#[cfg(all(feature = "borsh", not(feature = "std")))]
use alloc::{collections::BTreeMap, string::ToString};
use alloc::{collections::BTreeMap, string::ToString, vec};

#[cfg(all(feature = "borsh", feature = "std"))]
use std::{collections::BTreeMap, string::ToString};
use std::{collections::BTreeMap, string::ToString, vec};

#[cfg(feature = "schemars")]
use schemars::JsonSchema;
Expand Down Expand Up @@ -1073,10 +1070,10 @@ where
// Current ser/de for it is not optimal impl because const math is not stable nor primitives has bits traits.
// Uses minimal amount of bytes to fit needed amount of bits without compression (borsh does not have it anyway).
#[cfg(feature = "borsh")]
impl<T, const BITS: usize> BorshSerialize for UInt<T, BITS>
impl<T, const BITS: usize> borsh::BorshSerialize for UInt<T, BITS>
where
Self: Number,
T: BorshSerialize
T: borsh::BorshSerialize
+ From<u8>
+ BitAnd<T, Output = T>
+ TryInto<u8>
Expand Down Expand Up @@ -1104,9 +1101,9 @@ where

#[cfg(feature = "borsh")]
impl<
T: BorshDeserialize + core::cmp::PartialOrd<<UInt<T, BITS> as Number>::UnderlyingType>,
T: borsh::BorshDeserialize + PartialOrd<<UInt<T, BITS> as Number>::UnderlyingType>,
const BITS: usize,
> BorshDeserialize for UInt<T, BITS>
> borsh::BorshDeserialize for UInt<T, BITS>
where
Self: Number,
{
Expand All @@ -1126,7 +1123,7 @@ where
}

#[cfg(feature = "borsh")]
impl<T, const BITS: usize> BorshSchema for UInt<T, BITS> {
impl<T, const BITS: usize> borsh::BorshSchema for UInt<T, BITS> {
fn add_definitions_recursively(
definitions: &mut BTreeMap<borsh::schema::Declaration, borsh::schema::Definition>,
) {
Expand Down

0 comments on commit aef2d34

Please sign in to comment.