Skip to content

Commit

Permalink
[schema] #1897: Removed usize/isize from serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
SamHSmith committed Mar 24, 2022
1 parent deabdd6 commit 2ec9034
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub trait IntoSchema {
/// Applicable for types that represents decimal place of fixed point
pub trait DecimalPlacesAware {
/// decimal places of fixed point
fn decimal_places() -> usize;
fn decimal_places() -> u32;
}

/// Metadata
Expand Down Expand Up @@ -85,7 +85,7 @@ pub struct ArrayMeta {
/// Type
pub ty: String,
/// Length
pub len: usize,
pub len: u64,
}

/// Named fields
Expand Down Expand Up @@ -167,7 +167,7 @@ pub struct Compact<T>(T);
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
pub struct FixedMeta {
base: String,
decimal_places: usize,
decimal_places: u32,
}

macro_rules! impl_schema_int {
Expand Down Expand Up @@ -215,7 +215,7 @@ impl<I: IntoSchema, P: DecimalPlacesAware> IntoSchema for fixnum::FixedPoint<I,
}

impl DecimalPlacesAware for fixnum::typenum::U9 {
fn decimal_places() -> usize {
fn decimal_places() -> u32 {
9
}
}
Expand Down Expand Up @@ -359,7 +359,7 @@ impl<T: IntoSchema, const L: usize> IntoSchema for [T; L] {
let _ = map.entry(Self::type_name()).or_insert_with(|| {
Metadata::Array(ArrayMeta {
ty: T::type_name(),
len: L,
len: L.try_into().expect("usize should always fit in u64"),
})
});
if !map.contains_key(&T::type_name()) {
Expand Down

0 comments on commit 2ec9034

Please sign in to comment.