Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Jun 24, 2024
1 parent 8e48ea1 commit 5cd4821
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
10 changes: 0 additions & 10 deletions core/engine/src/builtins/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
use std::{fmt, str::FromStr};

use temporal_rs::options::RoundingIncrement;

use crate::{object::JsObject, string::JsStr, Context, JsNativeError, JsResult, JsString, JsValue};

/// A type used as an option parameter for [`get_option`].
Expand Down Expand Up @@ -126,14 +124,6 @@ impl OptionType for f64 {
}
}

impl OptionType for RoundingIncrement {
fn from_value(value: JsValue, context: &mut Context) -> JsResult<Self> {
let value = value.to_number(context)?;

Ok(RoundingIncrement::try_from(value)?)
}
}

#[derive(Debug, Copy, Clone, Default)]
pub(crate) enum RoundingMode {
Ceil,
Expand Down
14 changes: 11 additions & 3 deletions core/engine/src/builtins/temporal/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
// https://github.com/tc39/proposal-temporal/blob/main/polyfill/index.d.ts

use crate::{
builtins::options::{get_option, ParsableOptionType},
builtins::options::{get_option, OptionType, ParsableOptionType},
string::JsStr,
Context, JsNativeError, JsObject, JsResult,
Context, JsNativeError, JsObject, JsResult, JsValue,
};
use temporal_rs::options::{
ArithmeticOverflow, DurationOverflow, InstantDisambiguation, OffsetDisambiguation,
TemporalRoundingMode, TemporalUnit,
RoundingIncrement, TemporalRoundingMode, TemporalUnit,
};

// TODO: Expand docs on the below options.
Expand Down Expand Up @@ -99,3 +99,11 @@ impl ParsableOptionType for DurationOverflow {}
impl ParsableOptionType for InstantDisambiguation {}
impl ParsableOptionType for OffsetDisambiguation {}
impl ParsableOptionType for TemporalRoundingMode {}

impl OptionType for RoundingIncrement {
fn from_value(value: JsValue, context: &mut Context) -> JsResult<Self> {
let value = value.to_number(context)?;

Ok(RoundingIncrement::try_from(value)?)
}
}

0 comments on commit 5cd4821

Please sign in to comment.