Skip to content

Commit b80d6f2

Browse files
committed
to_plain_date temporal_capi implementation for FFI
1 parent 468782a commit b80d6f2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

temporal_capi/src/plain_date_time.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod ffi {
1212
ArithmeticOverflow, DifferenceSettings, DisplayCalendar, RoundingOptions,
1313
ToStringRoundingOptions,
1414
};
15-
use crate::plain_date::ffi::PartialDate;
15+
use crate::plain_date::ffi::{PartialDate, PlainDate};
1616
use crate::plain_time::ffi::{PartialTime, PlainTime};
1717
use diplomat_runtime::DiplomatWrite;
1818
use std::fmt::Write;
@@ -249,6 +249,13 @@ pub mod ffi {
249249
.map_err(Into::into)
250250
}
251251

252+
pub fn to_plain_date(&self) -> Result<Box<PlainDate>, TemporalError> {
253+
self.0
254+
.to_plain_date()
255+
.map(|x| Box::new(PlainDate(x)))
256+
.map_err(Into::into)
257+
}
258+
252259
pub fn to_plain_time(&self) -> Result<Box<PlainTime>, TemporalError> {
253260
self.0
254261
.to_plain_time()

0 commit comments

Comments
 (0)