Skip to content

Commit ad46374

Browse files
authored
Add try_from_offset_str ctor for TimeZone (#348)
1 parent 96504c9 commit ad46374

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

temporal_capi/bindings/c/TimeZone.h

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporal_capi/bindings/cpp/temporal_rs/TimeZone.d.hpp

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporal_capi/bindings/cpp/temporal_rs/TimeZone.hpp

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

temporal_capi/src/time_zone.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ pub mod ffi {
1919
.map(|x| Box::new(TimeZone(x)))
2020
.map_err(Into::into)
2121
}
22+
pub fn try_from_offset_str(ident: &DiplomatStr) -> Result<Box<Self>, TemporalError> {
23+
temporal_rs::UtcOffset::from_utf8(ident)
24+
.map(|x| Box::new(TimeZone(temporal_rs::TimeZone::UtcOffset(x))))
25+
.map_err(Into::into)
26+
}
2227
pub fn try_from_str(ident: &DiplomatStr) -> Result<Box<Self>, TemporalError> {
2328
let Ok(ident) = str::from_utf8(ident) else {
2429
return Err(temporal_rs::TemporalError::range().into());

0 commit comments

Comments
 (0)