diff --git a/Cargo.lock b/Cargo.lock index 8bd7d97df..4c4f3e819 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,9 +69,9 @@ dependencies = [ [[package]] name = "askama" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4744ed2eef2645831b441d8f5459689ade2ab27c854488fbab1fbe94fce1a7" +checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4" dependencies = [ "askama_derive", "itoa", @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "askama_derive" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d661e0f57be36a5c14c48f78d09011e67e0cb618f269cca9f2fd8d15b68c46ac" +checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f" dependencies = [ "askama_parser", "basic-toml", @@ -99,9 +99,9 @@ dependencies = [ [[package]] name = "askama_parser" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf315ce6524c857bb129ff794935cf6d42c82a6cff60526fe2a63593de4d0d4f" +checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358" dependencies = [ "memchr", "serde", @@ -290,8 +290,7 @@ version = "0.0.16" [[package]] name = "diplomat" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced081520ee8cf2b8c5b64a1a901eccd7030ece670dac274afe64607d6499b71" +source = "git+https://github.com/rust-diplomat/diplomat?rev=6d7c8746b126ea09230948a9c2f7c2de087624cc#6d7c8746b126ea09230948a9c2f7c2de087624cc" dependencies = [ "diplomat_core", "proc-macro2", @@ -309,14 +308,12 @@ dependencies = [ [[package]] name = "diplomat-runtime" version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "098f9520ec5c190943b083bca3ea4cc4e67dc5f85a37062e528ecf1d25f04eb4" +source = "git+https://github.com/rust-diplomat/diplomat?rev=6d7c8746b126ea09230948a9c2f7c2de087624cc#6d7c8746b126ea09230948a9c2f7c2de087624cc" [[package]] name = "diplomat-tool" version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d288eb6055935a8afa84caf60975a075163c9f3778365ff08b11cfc91ad4398e" +source = "git+https://github.com/rust-diplomat/diplomat?rev=6d7c8746b126ea09230948a9c2f7c2de087624cc#6d7c8746b126ea09230948a9c2f7c2de087624cc" dependencies = [ "askama", "clap", @@ -337,8 +334,7 @@ dependencies = [ [[package]] name = "diplomat_core" version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad619d9fdee0e731bb6f8f7d797b6ecfdc2395e363f554d2f6377155955171eb" +source = "git+https://github.com/rust-diplomat/diplomat?rev=6d7c8746b126ea09230948a9c2f7c2de087624cc#6d7c8746b126ea09230948a9c2f7c2de087624cc" dependencies = [ "displaydoc", "either", diff --git a/Cargo.toml b/Cargo.toml index 4ce1e34c0..d8da07666 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,12 @@ web-time = "1.1.0" zerovec = "0.11.4" zoneinfo64 = "0.2.0" +# Diplomat +diplomat-tool = { git = "https://github.com/rust-diplomat/diplomat", rev = "6d7c8746b126ea09230948a9c2f7c2de087624cc", default-features = false } +diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat", rev = "6d7c8746b126ea09230948a9c2f7c2de087624cc", default-features = false } +diplomat = { git = "https://github.com/rust-diplomat/diplomat", rev = "6d7c8746b126ea09230948a9c2f7c2de087624cc", default-features = false } + + [package] name = "temporal_rs" keywords = ["date", "time", "calendar", "timezone", "duration"] diff --git a/temporal_capi/Cargo.toml b/temporal_capi/Cargo.toml index 66fc42d70..c6201edbf 100644 --- a/temporal_capi/Cargo.toml +++ b/temporal_capi/Cargo.toml @@ -18,8 +18,8 @@ include = [ ] [dependencies] -diplomat = "0.12.0" -diplomat-runtime = "0.12.0" +diplomat.workspace = true +diplomat-runtime.workspace = true num-traits.workspace = true temporal_rs = { workspace = true, default-features = false } timezone_provider = { workspace = true, default-features = false } diff --git a/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.d.hpp index aa6b9544b..d7d93fd33 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_AnyCalendarKind_D_HPP -#define temporal_rs_AnyCalendarKind_D_HPP +#ifndef TEMPORAL_RS_AnyCalendarKind_D_HPP +#define TEMPORAL_RS_AnyCalendarKind_D_HPP #include #include @@ -9,11 +9,11 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { class AnyCalendarKind; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -46,44 +46,44 @@ namespace capi { namespace temporal_rs { class AnyCalendarKind { public: - enum Value { - Buddhist = 0, - Chinese = 1, - Coptic = 2, - Dangi = 3, - Ethiopian = 4, - EthiopianAmeteAlem = 5, - Gregorian = 6, - Hebrew = 7, - Indian = 8, - HijriTabularTypeIIFriday = 9, - HijriSimulatedMecca = 10, - HijriTabularTypeIIThursday = 11, - HijriUmmAlQura = 12, - Iso = 13, - Japanese = 14, - JapaneseExtended = 15, - Persian = 16, - Roc = 17, - }; + enum Value { + Buddhist = 0, + Chinese = 1, + Coptic = 2, + Dangi = 3, + Ethiopian = 4, + EthiopianAmeteAlem = 5, + Gregorian = 6, + Hebrew = 7, + Indian = 8, + HijriTabularTypeIIFriday = 9, + HijriSimulatedMecca = 10, + HijriTabularTypeIIThursday = 11, + HijriUmmAlQura = 12, + Iso = 13, + Japanese = 14, + JapaneseExtended = 15, + Persian = 16, + Roc = 17, + }; - AnyCalendarKind(): value(Value::Buddhist) {} + AnyCalendarKind(): value(Value::Buddhist) {} - // Implicit conversions between enum and ::Value - constexpr AnyCalendarKind(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; + // Implicit conversions between enum and ::Value + constexpr AnyCalendarKind(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; inline static std::optional get_for_str(std::string_view s); inline static std::optional parse_temporal_calendar_string(std::string_view s); - inline temporal_rs::capi::AnyCalendarKind AsFFI() const; - inline static temporal_rs::AnyCalendarKind FromFFI(temporal_rs::capi::AnyCalendarKind c_enum); + inline temporal_rs::capi::AnyCalendarKind AsFFI() const; + inline static temporal_rs::AnyCalendarKind FromFFI(temporal_rs::capi::AnyCalendarKind c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_AnyCalendarKind_D_HPP +#endif // TEMPORAL_RS_AnyCalendarKind_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.hpp b/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.hpp index 5ef873287..810aae25a 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/AnyCalendarKind.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_AnyCalendarKind_HPP -#define temporal_rs_AnyCalendarKind_HPP +#ifndef TEMPORAL_RS_AnyCalendarKind_HPP +#define TEMPORAL_RS_AnyCalendarKind_HPP #include "AnyCalendarKind.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -19,52 +19,52 @@ namespace capi { extern "C" { typedef struct temporal_rs_AnyCalendarKind_get_for_str_result {union {temporal_rs::capi::AnyCalendarKind ok; }; bool is_ok;} temporal_rs_AnyCalendarKind_get_for_str_result; - temporal_rs_AnyCalendarKind_get_for_str_result temporal_rs_AnyCalendarKind_get_for_str(diplomat::capi::DiplomatStringView s); + temporal_rs_AnyCalendarKind_get_for_str_result temporal_rs_AnyCalendarKind_get_for_str(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_AnyCalendarKind_parse_temporal_calendar_string_result {union {temporal_rs::capi::AnyCalendarKind ok; }; bool is_ok;} temporal_rs_AnyCalendarKind_parse_temporal_calendar_string_result; - temporal_rs_AnyCalendarKind_parse_temporal_calendar_string_result temporal_rs_AnyCalendarKind_parse_temporal_calendar_string(diplomat::capi::DiplomatStringView s); + temporal_rs_AnyCalendarKind_parse_temporal_calendar_string_result temporal_rs_AnyCalendarKind_parse_temporal_calendar_string(temporal_rs::diplomat::capi::DiplomatStringView s); } // extern "C" } // namespace capi } // namespace inline temporal_rs::capi::AnyCalendarKind temporal_rs::AnyCalendarKind::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::AnyCalendarKind temporal_rs::AnyCalendarKind::FromFFI(temporal_rs::capi::AnyCalendarKind c_enum) { - switch (c_enum) { - case temporal_rs::capi::AnyCalendarKind_Buddhist: - case temporal_rs::capi::AnyCalendarKind_Chinese: - case temporal_rs::capi::AnyCalendarKind_Coptic: - case temporal_rs::capi::AnyCalendarKind_Dangi: - case temporal_rs::capi::AnyCalendarKind_Ethiopian: - case temporal_rs::capi::AnyCalendarKind_EthiopianAmeteAlem: - case temporal_rs::capi::AnyCalendarKind_Gregorian: - case temporal_rs::capi::AnyCalendarKind_Hebrew: - case temporal_rs::capi::AnyCalendarKind_Indian: - case temporal_rs::capi::AnyCalendarKind_HijriTabularTypeIIFriday: - case temporal_rs::capi::AnyCalendarKind_HijriSimulatedMecca: - case temporal_rs::capi::AnyCalendarKind_HijriTabularTypeIIThursday: - case temporal_rs::capi::AnyCalendarKind_HijriUmmAlQura: - case temporal_rs::capi::AnyCalendarKind_Iso: - case temporal_rs::capi::AnyCalendarKind_Japanese: - case temporal_rs::capi::AnyCalendarKind_JapaneseExtended: - case temporal_rs::capi::AnyCalendarKind_Persian: - case temporal_rs::capi::AnyCalendarKind_Roc: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::AnyCalendarKind_Buddhist: + case temporal_rs::capi::AnyCalendarKind_Chinese: + case temporal_rs::capi::AnyCalendarKind_Coptic: + case temporal_rs::capi::AnyCalendarKind_Dangi: + case temporal_rs::capi::AnyCalendarKind_Ethiopian: + case temporal_rs::capi::AnyCalendarKind_EthiopianAmeteAlem: + case temporal_rs::capi::AnyCalendarKind_Gregorian: + case temporal_rs::capi::AnyCalendarKind_Hebrew: + case temporal_rs::capi::AnyCalendarKind_Indian: + case temporal_rs::capi::AnyCalendarKind_HijriTabularTypeIIFriday: + case temporal_rs::capi::AnyCalendarKind_HijriSimulatedMecca: + case temporal_rs::capi::AnyCalendarKind_HijriTabularTypeIIThursday: + case temporal_rs::capi::AnyCalendarKind_HijriUmmAlQura: + case temporal_rs::capi::AnyCalendarKind_Iso: + case temporal_rs::capi::AnyCalendarKind_Japanese: + case temporal_rs::capi::AnyCalendarKind_JapaneseExtended: + case temporal_rs::capi::AnyCalendarKind_Persian: + case temporal_rs::capi::AnyCalendarKind_Roc: + return static_cast(c_enum); + default: + std::abort(); + } } inline std::optional temporal_rs::AnyCalendarKind::get_for_str(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_AnyCalendarKind_get_for_str({s.data(), s.size()}); - return result.is_ok ? std::optional(temporal_rs::AnyCalendarKind::FromFFI(result.ok)) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_AnyCalendarKind_get_for_str({s.data(), s.size()}); + return result.is_ok ? std::optional(temporal_rs::AnyCalendarKind::FromFFI(result.ok)) : std::nullopt; } inline std::optional temporal_rs::AnyCalendarKind::parse_temporal_calendar_string(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_AnyCalendarKind_parse_temporal_calendar_string({s.data(), s.size()}); - return result.is_ok ? std::optional(temporal_rs::AnyCalendarKind::FromFFI(result.ok)) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_AnyCalendarKind_parse_temporal_calendar_string({s.data(), s.size()}); + return result.is_ok ? std::optional(temporal_rs::AnyCalendarKind::FromFFI(result.ok)) : std::nullopt; } -#endif // temporal_rs_AnyCalendarKind_HPP +#endif // TEMPORAL_RS_AnyCalendarKind_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.d.hpp index e8ff54759..0e9129578 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ArithmeticOverflow_D_HPP -#define temporal_rs_ArithmeticOverflow_D_HPP +#ifndef TEMPORAL_RS_ArithmeticOverflow_D_HPP +#define TEMPORAL_RS_ArithmeticOverflow_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,24 +26,24 @@ namespace capi { namespace temporal_rs { class ArithmeticOverflow { public: - enum Value { - Constrain = 0, - Reject = 1, - }; + enum Value { + Constrain = 0, + Reject = 1, + }; - ArithmeticOverflow(): value(Value::Constrain) {} + ArithmeticOverflow(): value(Value::Constrain) {} - // Implicit conversions between enum and ::Value - constexpr ArithmeticOverflow(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; + // Implicit conversions between enum and ::Value + constexpr ArithmeticOverflow(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; - inline temporal_rs::capi::ArithmeticOverflow AsFFI() const; - inline static temporal_rs::ArithmeticOverflow FromFFI(temporal_rs::capi::ArithmeticOverflow c_enum); + inline temporal_rs::capi::ArithmeticOverflow AsFFI() const; + inline static temporal_rs::ArithmeticOverflow FromFFI(temporal_rs::capi::ArithmeticOverflow c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_ArithmeticOverflow_D_HPP +#endif // TEMPORAL_RS_ArithmeticOverflow_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.hpp b/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.hpp index 9c0bc9e1a..10a177386 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ArithmeticOverflow.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ArithmeticOverflow_HPP -#define temporal_rs_ArithmeticOverflow_HPP +#ifndef TEMPORAL_RS_ArithmeticOverflow_HPP +#define TEMPORAL_RS_ArithmeticOverflow_HPP #include "ArithmeticOverflow.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,16 +23,16 @@ namespace capi { } // namespace inline temporal_rs::capi::ArithmeticOverflow temporal_rs::ArithmeticOverflow::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::ArithmeticOverflow temporal_rs::ArithmeticOverflow::FromFFI(temporal_rs::capi::ArithmeticOverflow c_enum) { - switch (c_enum) { - case temporal_rs::capi::ArithmeticOverflow_Constrain: - case temporal_rs::capi::ArithmeticOverflow_Reject: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::ArithmeticOverflow_Constrain: + case temporal_rs::capi::ArithmeticOverflow_Reject: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_ArithmeticOverflow_HPP +#endif // TEMPORAL_RS_ArithmeticOverflow_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Calendar.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Calendar.d.hpp index 4b1097a2f..446f2bc7a 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Calendar.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Calendar.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Calendar_D_HPP -#define temporal_rs_Calendar_D_HPP +#ifndef TEMPORAL_RS_Calendar_D_HPP +#define TEMPORAL_RS_Calendar_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Calendar; } class Calendar; struct TemporalError; class AnyCalendarKind; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -35,30 +35,30 @@ class Calendar { inline static std::unique_ptr try_new_constrain(temporal_rs::AnyCalendarKind kind); - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); inline bool is_iso() const; inline std::string_view identifier() const; - /** - * Returns the kind of this calendar - */ + /** + * Returns the kind of this calendar + */ inline temporal_rs::AnyCalendarKind kind() const; - inline const temporal_rs::capi::Calendar* AsFFI() const; - inline temporal_rs::capi::Calendar* AsFFI(); - inline static const temporal_rs::Calendar* FromFFI(const temporal_rs::capi::Calendar* ptr); - inline static temporal_rs::Calendar* FromFFI(temporal_rs::capi::Calendar* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::Calendar* AsFFI() const; + inline temporal_rs::capi::Calendar* AsFFI(); + inline static const temporal_rs::Calendar* FromFFI(const temporal_rs::capi::Calendar* ptr); + inline static temporal_rs::Calendar* FromFFI(temporal_rs::capi::Calendar* ptr); + inline static void operator delete(void* ptr); private: - Calendar() = delete; - Calendar(const temporal_rs::Calendar&) = delete; - Calendar(temporal_rs::Calendar&&) noexcept = delete; - Calendar operator=(const temporal_rs::Calendar&) = delete; - Calendar operator=(temporal_rs::Calendar&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + Calendar() = delete; + Calendar(const temporal_rs::Calendar&) = delete; + Calendar(temporal_rs::Calendar&&) noexcept = delete; + Calendar operator=(const temporal_rs::Calendar&) = delete; + Calendar operator=(temporal_rs::Calendar&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_Calendar_D_HPP +#endif // TEMPORAL_RS_Calendar_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Calendar.hpp b/temporal_capi/bindings/cpp/temporal_rs/Calendar.hpp index 470a92b66..06509ab1a 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Calendar.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Calendar.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Calendar_HPP -#define temporal_rs_Calendar_HPP +#ifndef TEMPORAL_RS_Calendar_HPP +#define TEMPORAL_RS_Calendar_HPP #include "Calendar.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" #include "TemporalError.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,11 +23,11 @@ namespace capi { temporal_rs::capi::Calendar* temporal_rs_Calendar_try_new_constrain(temporal_rs::capi::AnyCalendarKind kind); typedef struct temporal_rs_Calendar_from_utf8_result {union {temporal_rs::capi::Calendar* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Calendar_from_utf8_result; - temporal_rs_Calendar_from_utf8_result temporal_rs_Calendar_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_Calendar_from_utf8_result temporal_rs_Calendar_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); bool temporal_rs_Calendar_is_iso(const temporal_rs::capi::Calendar* self); - diplomat::capi::DiplomatStringView temporal_rs_Calendar_identifier(const temporal_rs::capi::Calendar* self); + temporal_rs::diplomat::capi::DiplomatStringView temporal_rs_Calendar_identifier(const temporal_rs::capi::Calendar* self); temporal_rs::capi::AnyCalendarKind temporal_rs_Calendar_kind(const temporal_rs::capi::Calendar* self); @@ -38,49 +38,49 @@ namespace capi { } // namespace inline std::unique_ptr temporal_rs::Calendar::try_new_constrain(temporal_rs::AnyCalendarKind kind) { - auto result = temporal_rs::capi::temporal_rs_Calendar_try_new_constrain(kind.AsFFI()); - return std::unique_ptr(temporal_rs::Calendar::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Calendar_try_new_constrain(kind.AsFFI()); + return std::unique_ptr(temporal_rs::Calendar::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Calendar::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_Calendar_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Calendar::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Calendar::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_Calendar_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Calendar::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::Calendar::is_iso() const { - auto result = temporal_rs::capi::temporal_rs_Calendar_is_iso(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Calendar_is_iso(this->AsFFI()); + return result; } inline std::string_view temporal_rs::Calendar::identifier() const { - auto result = temporal_rs::capi::temporal_rs_Calendar_identifier(this->AsFFI()); - return std::string_view(result.data, result.len); + auto result = temporal_rs::capi::temporal_rs_Calendar_identifier(this->AsFFI()); + return std::string_view(result.data, result.len); } inline temporal_rs::AnyCalendarKind temporal_rs::Calendar::kind() const { - auto result = temporal_rs::capi::temporal_rs_Calendar_kind(this->AsFFI()); - return temporal_rs::AnyCalendarKind::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_Calendar_kind(this->AsFFI()); + return temporal_rs::AnyCalendarKind::FromFFI(result); } inline const temporal_rs::capi::Calendar* temporal_rs::Calendar::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::Calendar* temporal_rs::Calendar::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::Calendar* temporal_rs::Calendar::FromFFI(const temporal_rs::capi::Calendar* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::Calendar* temporal_rs::Calendar::FromFFI(temporal_rs::capi::Calendar* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::Calendar::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_Calendar_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_Calendar_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_Calendar_HPP +#endif // TEMPORAL_RS_Calendar_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DateDuration.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/DateDuration.d.hpp index eb0fe1131..f677dcfe0 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DateDuration.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DateDuration.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DateDuration_D_HPP -#define temporal_rs_DateDuration_D_HPP +#ifndef TEMPORAL_RS_DateDuration_D_HPP +#define TEMPORAL_RS_DateDuration_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct DateDuration; } class DateDuration; struct TemporalError; class Sign; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -29,7 +29,7 @@ namespace temporal_rs { class DateDuration { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new(int64_t years, int64_t months, int64_t weeks, int64_t days); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(int64_t years, int64_t months, int64_t weeks, int64_t days); inline std::unique_ptr abs() const; @@ -37,19 +37,19 @@ class DateDuration { inline temporal_rs::Sign sign() const; - inline const temporal_rs::capi::DateDuration* AsFFI() const; - inline temporal_rs::capi::DateDuration* AsFFI(); - inline static const temporal_rs::DateDuration* FromFFI(const temporal_rs::capi::DateDuration* ptr); - inline static temporal_rs::DateDuration* FromFFI(temporal_rs::capi::DateDuration* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::DateDuration* AsFFI() const; + inline temporal_rs::capi::DateDuration* AsFFI(); + inline static const temporal_rs::DateDuration* FromFFI(const temporal_rs::capi::DateDuration* ptr); + inline static temporal_rs::DateDuration* FromFFI(temporal_rs::capi::DateDuration* ptr); + inline static void operator delete(void* ptr); private: - DateDuration() = delete; - DateDuration(const temporal_rs::DateDuration&) = delete; - DateDuration(temporal_rs::DateDuration&&) noexcept = delete; - DateDuration operator=(const temporal_rs::DateDuration&) = delete; - DateDuration operator=(temporal_rs::DateDuration&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + DateDuration() = delete; + DateDuration(const temporal_rs::DateDuration&) = delete; + DateDuration(temporal_rs::DateDuration&&) noexcept = delete; + DateDuration operator=(const temporal_rs::DateDuration&) = delete; + DateDuration operator=(temporal_rs::DateDuration&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_DateDuration_D_HPP +#endif // TEMPORAL_RS_DateDuration_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DateDuration.hpp b/temporal_capi/bindings/cpp/temporal_rs/DateDuration.hpp index b4df8dcc3..b41b4610e 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DateDuration.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DateDuration.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DateDuration_HPP -#define temporal_rs_DateDuration_HPP +#ifndef TEMPORAL_RS_DateDuration_HPP +#define TEMPORAL_RS_DateDuration_HPP #include "DateDuration.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "Sign.hpp" #include "TemporalError.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -35,48 +35,48 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::DateDuration::try_new(int64_t years, int64_t months, int64_t weeks, int64_t days) { - auto result = temporal_rs::capi::temporal_rs_DateDuration_try_new(years, - months, - weeks, - days); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::DateDuration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::DateDuration::try_new(int64_t years, int64_t months, int64_t weeks, int64_t days) { + auto result = temporal_rs::capi::temporal_rs_DateDuration_try_new(years, + months, + weeks, + days); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::DateDuration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::DateDuration::abs() const { - auto result = temporal_rs::capi::temporal_rs_DateDuration_abs(this->AsFFI()); - return std::unique_ptr(temporal_rs::DateDuration::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_DateDuration_abs(this->AsFFI()); + return std::unique_ptr(temporal_rs::DateDuration::FromFFI(result)); } inline std::unique_ptr temporal_rs::DateDuration::negated() const { - auto result = temporal_rs::capi::temporal_rs_DateDuration_negated(this->AsFFI()); - return std::unique_ptr(temporal_rs::DateDuration::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_DateDuration_negated(this->AsFFI()); + return std::unique_ptr(temporal_rs::DateDuration::FromFFI(result)); } inline temporal_rs::Sign temporal_rs::DateDuration::sign() const { - auto result = temporal_rs::capi::temporal_rs_DateDuration_sign(this->AsFFI()); - return temporal_rs::Sign::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_DateDuration_sign(this->AsFFI()); + return temporal_rs::Sign::FromFFI(result); } inline const temporal_rs::capi::DateDuration* temporal_rs::DateDuration::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::DateDuration* temporal_rs::DateDuration::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::DateDuration* temporal_rs::DateDuration::FromFFI(const temporal_rs::capi::DateDuration* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::DateDuration* temporal_rs::DateDuration::FromFFI(temporal_rs::capi::DateDuration* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::DateDuration::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_DateDuration_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_DateDuration_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_DateDuration_HPP +#endif // TEMPORAL_RS_DateDuration_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.d.hpp index e2dd82693..e87224fe4 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DifferenceSettings_D_HPP -#define temporal_rs_DifferenceSettings_D_HPP +#ifndef TEMPORAL_RS_DifferenceSettings_D_HPP +#define TEMPORAL_RS_DifferenceSettings_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "RoundingMode.d.hpp" #include "Unit.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { class RoundingMode; class Unit; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -25,7 +25,7 @@ namespace capi { temporal_rs::capi::Unit_option largest_unit; temporal_rs::capi::Unit_option smallest_unit; temporal_rs::capi::RoundingMode_option rounding_mode; - diplomat::capi::OptionU32 increment; + temporal_rs::diplomat::capi::OptionU32 increment; }; typedef struct DifferenceSettings_option {union { DifferenceSettings ok; }; bool is_ok; } DifferenceSettings_option; @@ -35,14 +35,14 @@ namespace capi { namespace temporal_rs { struct DifferenceSettings { - std::optional largest_unit; - std::optional smallest_unit; - std::optional rounding_mode; - std::optional increment; + std::optional largest_unit; + std::optional smallest_unit; + std::optional rounding_mode; + std::optional increment; - inline temporal_rs::capi::DifferenceSettings AsFFI() const; - inline static temporal_rs::DifferenceSettings FromFFI(temporal_rs::capi::DifferenceSettings c_struct); + inline temporal_rs::capi::DifferenceSettings AsFFI() const; + inline static temporal_rs::DifferenceSettings FromFFI(temporal_rs::capi::DifferenceSettings c_struct); }; } // namespace -#endif // temporal_rs_DifferenceSettings_D_HPP +#endif // TEMPORAL_RS_DifferenceSettings_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.hpp b/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.hpp index e6daa3ab6..d00ab0e5b 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DifferenceSettings.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DifferenceSettings_HPP -#define temporal_rs_DifferenceSettings_HPP +#ifndef TEMPORAL_RS_DifferenceSettings_HPP +#define TEMPORAL_RS_DifferenceSettings_HPP #include "DifferenceSettings.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "RoundingMode.hpp" #include "Unit.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,22 +26,22 @@ namespace capi { inline temporal_rs::capi::DifferenceSettings temporal_rs::DifferenceSettings::AsFFI() const { - return temporal_rs::capi::DifferenceSettings { - /* .largest_unit = */ largest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { largest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), - /* .smallest_unit = */ smallest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { smallest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), - /* .rounding_mode = */ rounding_mode.has_value() ? (temporal_rs::capi::RoundingMode_option{ { rounding_mode.value().AsFFI() }, true }) : (temporal_rs::capi::RoundingMode_option{ {}, false }), - /* .increment = */ increment.has_value() ? (diplomat::capi::OptionU32{ { increment.value() }, true }) : (diplomat::capi::OptionU32{ {}, false }), - }; + return temporal_rs::capi::DifferenceSettings { + /* .largest_unit = */ largest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { largest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), + /* .smallest_unit = */ smallest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { smallest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), + /* .rounding_mode = */ rounding_mode.has_value() ? (temporal_rs::capi::RoundingMode_option{ { rounding_mode.value().AsFFI() }, true }) : (temporal_rs::capi::RoundingMode_option{ {}, false }), + /* .increment = */ increment.has_value() ? (temporal_rs::diplomat::capi::OptionU32{ { increment.value() }, true }) : (temporal_rs::diplomat::capi::OptionU32{ {}, false }), + }; } inline temporal_rs::DifferenceSettings temporal_rs::DifferenceSettings::FromFFI(temporal_rs::capi::DifferenceSettings c_struct) { - return temporal_rs::DifferenceSettings { - /* .largest_unit = */ c_struct.largest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.largest_unit.ok)) : std::nullopt, - /* .smallest_unit = */ c_struct.smallest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.smallest_unit.ok)) : std::nullopt, - /* .rounding_mode = */ c_struct.rounding_mode.is_ok ? std::optional(temporal_rs::RoundingMode::FromFFI(c_struct.rounding_mode.ok)) : std::nullopt, - /* .increment = */ c_struct.increment.is_ok ? std::optional(c_struct.increment.ok) : std::nullopt, - }; + return temporal_rs::DifferenceSettings { + /* .largest_unit = */ c_struct.largest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.largest_unit.ok)) : std::nullopt, + /* .smallest_unit = */ c_struct.smallest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.smallest_unit.ok)) : std::nullopt, + /* .rounding_mode = */ c_struct.rounding_mode.is_ok ? std::optional(temporal_rs::RoundingMode::FromFFI(c_struct.rounding_mode.ok)) : std::nullopt, + /* .increment = */ c_struct.increment.is_ok ? std::optional(c_struct.increment.ok) : std::nullopt, + }; } -#endif // temporal_rs_DifferenceSettings_HPP +#endif // TEMPORAL_RS_DifferenceSettings_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.d.hpp index 8ae1ee49a..648cdc6e6 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Disambiguation_D_HPP -#define temporal_rs_Disambiguation_D_HPP +#ifndef TEMPORAL_RS_Disambiguation_D_HPP +#define TEMPORAL_RS_Disambiguation_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -28,26 +28,26 @@ namespace capi { namespace temporal_rs { class Disambiguation { public: - enum Value { - Compatible = 0, - Earlier = 1, - Later = 2, - Reject = 3, - }; - - Disambiguation(): value(Value::Compatible) {} - - // Implicit conversions between enum and ::Value - constexpr Disambiguation(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::Disambiguation AsFFI() const; - inline static temporal_rs::Disambiguation FromFFI(temporal_rs::capi::Disambiguation c_enum); + enum Value { + Compatible = 0, + Earlier = 1, + Later = 2, + Reject = 3, + }; + + Disambiguation(): value(Value::Compatible) {} + + // Implicit conversions between enum and ::Value + constexpr Disambiguation(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::Disambiguation AsFFI() const; + inline static temporal_rs::Disambiguation FromFFI(temporal_rs::capi::Disambiguation c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_Disambiguation_D_HPP +#endif // TEMPORAL_RS_Disambiguation_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.hpp b/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.hpp index 187f49d71..15476c9ed 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Disambiguation.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Disambiguation_HPP -#define temporal_rs_Disambiguation_HPP +#ifndef TEMPORAL_RS_Disambiguation_HPP +#define TEMPORAL_RS_Disambiguation_HPP #include "Disambiguation.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,18 +23,18 @@ namespace capi { } // namespace inline temporal_rs::capi::Disambiguation temporal_rs::Disambiguation::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::Disambiguation temporal_rs::Disambiguation::FromFFI(temporal_rs::capi::Disambiguation c_enum) { - switch (c_enum) { - case temporal_rs::capi::Disambiguation_Compatible: - case temporal_rs::capi::Disambiguation_Earlier: - case temporal_rs::capi::Disambiguation_Later: - case temporal_rs::capi::Disambiguation_Reject: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::Disambiguation_Compatible: + case temporal_rs::capi::Disambiguation_Earlier: + case temporal_rs::capi::Disambiguation_Later: + case temporal_rs::capi::Disambiguation_Reject: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_Disambiguation_HPP +#endif // TEMPORAL_RS_Disambiguation_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.d.hpp index 51390cb5c..272ccb3e6 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DisplayCalendar_D_HPP -#define temporal_rs_DisplayCalendar_D_HPP +#ifndef TEMPORAL_RS_DisplayCalendar_D_HPP +#define TEMPORAL_RS_DisplayCalendar_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -28,26 +28,26 @@ namespace capi { namespace temporal_rs { class DisplayCalendar { public: - enum Value { - Auto = 0, - Always = 1, - Never = 2, - Critical = 3, - }; - - DisplayCalendar(): value(Value::Auto) {} - - // Implicit conversions between enum and ::Value - constexpr DisplayCalendar(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::DisplayCalendar AsFFI() const; - inline static temporal_rs::DisplayCalendar FromFFI(temporal_rs::capi::DisplayCalendar c_enum); + enum Value { + Auto = 0, + Always = 1, + Never = 2, + Critical = 3, + }; + + DisplayCalendar(): value(Value::Auto) {} + + // Implicit conversions between enum and ::Value + constexpr DisplayCalendar(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::DisplayCalendar AsFFI() const; + inline static temporal_rs::DisplayCalendar FromFFI(temporal_rs::capi::DisplayCalendar c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_DisplayCalendar_D_HPP +#endif // TEMPORAL_RS_DisplayCalendar_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.hpp b/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.hpp index a0c90728e..4225d477d 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DisplayCalendar.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DisplayCalendar_HPP -#define temporal_rs_DisplayCalendar_HPP +#ifndef TEMPORAL_RS_DisplayCalendar_HPP +#define TEMPORAL_RS_DisplayCalendar_HPP #include "DisplayCalendar.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,18 +23,18 @@ namespace capi { } // namespace inline temporal_rs::capi::DisplayCalendar temporal_rs::DisplayCalendar::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::DisplayCalendar temporal_rs::DisplayCalendar::FromFFI(temporal_rs::capi::DisplayCalendar c_enum) { - switch (c_enum) { - case temporal_rs::capi::DisplayCalendar_Auto: - case temporal_rs::capi::DisplayCalendar_Always: - case temporal_rs::capi::DisplayCalendar_Never: - case temporal_rs::capi::DisplayCalendar_Critical: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::DisplayCalendar_Auto: + case temporal_rs::capi::DisplayCalendar_Always: + case temporal_rs::capi::DisplayCalendar_Never: + case temporal_rs::capi::DisplayCalendar_Critical: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_DisplayCalendar_HPP +#endif // TEMPORAL_RS_DisplayCalendar_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.d.hpp index 8b925f519..da19e959c 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DisplayOffset_D_HPP -#define temporal_rs_DisplayOffset_D_HPP +#ifndef TEMPORAL_RS_DisplayOffset_D_HPP +#define TEMPORAL_RS_DisplayOffset_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,24 +26,24 @@ namespace capi { namespace temporal_rs { class DisplayOffset { public: - enum Value { - Auto = 0, - Never = 1, - }; + enum Value { + Auto = 0, + Never = 1, + }; - DisplayOffset(): value(Value::Auto) {} + DisplayOffset(): value(Value::Auto) {} - // Implicit conversions between enum and ::Value - constexpr DisplayOffset(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; + // Implicit conversions between enum and ::Value + constexpr DisplayOffset(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; - inline temporal_rs::capi::DisplayOffset AsFFI() const; - inline static temporal_rs::DisplayOffset FromFFI(temporal_rs::capi::DisplayOffset c_enum); + inline temporal_rs::capi::DisplayOffset AsFFI() const; + inline static temporal_rs::DisplayOffset FromFFI(temporal_rs::capi::DisplayOffset c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_DisplayOffset_D_HPP +#endif // TEMPORAL_RS_DisplayOffset_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.hpp b/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.hpp index bab6153ac..ab63e3fe1 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DisplayOffset.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DisplayOffset_HPP -#define temporal_rs_DisplayOffset_HPP +#ifndef TEMPORAL_RS_DisplayOffset_HPP +#define TEMPORAL_RS_DisplayOffset_HPP #include "DisplayOffset.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,16 +23,16 @@ namespace capi { } // namespace inline temporal_rs::capi::DisplayOffset temporal_rs::DisplayOffset::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::DisplayOffset temporal_rs::DisplayOffset::FromFFI(temporal_rs::capi::DisplayOffset c_enum) { - switch (c_enum) { - case temporal_rs::capi::DisplayOffset_Auto: - case temporal_rs::capi::DisplayOffset_Never: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::DisplayOffset_Auto: + case temporal_rs::capi::DisplayOffset_Never: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_DisplayOffset_HPP +#endif // TEMPORAL_RS_DisplayOffset_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.d.hpp index 8bbcbf2d0..3e2ec2155 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DisplayTimeZone_D_HPP -#define temporal_rs_DisplayTimeZone_D_HPP +#ifndef TEMPORAL_RS_DisplayTimeZone_D_HPP +#define TEMPORAL_RS_DisplayTimeZone_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -27,25 +27,25 @@ namespace capi { namespace temporal_rs { class DisplayTimeZone { public: - enum Value { - Auto = 0, - Never = 1, - Critical = 2, - }; - - DisplayTimeZone(): value(Value::Auto) {} - - // Implicit conversions between enum and ::Value - constexpr DisplayTimeZone(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::DisplayTimeZone AsFFI() const; - inline static temporal_rs::DisplayTimeZone FromFFI(temporal_rs::capi::DisplayTimeZone c_enum); + enum Value { + Auto = 0, + Never = 1, + Critical = 2, + }; + + DisplayTimeZone(): value(Value::Auto) {} + + // Implicit conversions between enum and ::Value + constexpr DisplayTimeZone(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::DisplayTimeZone AsFFI() const; + inline static temporal_rs::DisplayTimeZone FromFFI(temporal_rs::capi::DisplayTimeZone c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_DisplayTimeZone_D_HPP +#endif // TEMPORAL_RS_DisplayTimeZone_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.hpp b/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.hpp index d7d6227a0..3341bd73b 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/DisplayTimeZone.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_DisplayTimeZone_HPP -#define temporal_rs_DisplayTimeZone_HPP +#ifndef TEMPORAL_RS_DisplayTimeZone_HPP +#define TEMPORAL_RS_DisplayTimeZone_HPP #include "DisplayTimeZone.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,17 +23,17 @@ namespace capi { } // namespace inline temporal_rs::capi::DisplayTimeZone temporal_rs::DisplayTimeZone::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::DisplayTimeZone temporal_rs::DisplayTimeZone::FromFFI(temporal_rs::capi::DisplayTimeZone c_enum) { - switch (c_enum) { - case temporal_rs::capi::DisplayTimeZone_Auto: - case temporal_rs::capi::DisplayTimeZone_Never: - case temporal_rs::capi::DisplayTimeZone_Critical: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::DisplayTimeZone_Auto: + case temporal_rs::capi::DisplayTimeZone_Never: + case temporal_rs::capi::DisplayTimeZone_Critical: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_DisplayTimeZone_HPP +#endif // TEMPORAL_RS_DisplayTimeZone_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Duration.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Duration.d.hpp index 04fdb8b96..e529ad069 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Duration.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Duration.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Duration_D_HPP -#define temporal_rs_Duration_D_HPP +#ifndef TEMPORAL_RS_Duration_D_HPP +#define TEMPORAL_RS_Duration_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Duration; } class Duration; @@ -23,7 +22,8 @@ struct TemporalError; struct ToStringRoundingOptions; class Sign; class Unit; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -36,18 +36,18 @@ namespace temporal_rs { class Duration { public: - /** - * Temporary API until v8 can move off of it - */ - inline static diplomat::result, temporal_rs::TemporalError> create(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds); + /** + * Temporary API until v8 can move off of it + */ + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> create(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds); - inline static diplomat::result, temporal_rs::TemporalError> try_new(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds); - inline static diplomat::result, temporal_rs::TemporalError> from_partial_duration(temporal_rs::PartialDuration partial); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial_duration(temporal_rs::PartialDuration partial); - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); inline bool is_time_within_range() const; @@ -79,41 +79,41 @@ class Duration { inline std::unique_ptr negated() const; - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& other) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& other) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& other) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& other) const; - inline diplomat::result to_string(temporal_rs::ToStringRoundingOptions options) const; + inline temporal_rs::diplomat::result to_string(temporal_rs::ToStringRoundingOptions options) const; template - inline diplomat::result to_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; + inline temporal_rs::diplomat::result to_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; - inline diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to) const; - inline diplomat::result, temporal_rs::TemporalError> round_with_provider(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round_with_provider(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const; - inline diplomat::result compare(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to) const; + inline temporal_rs::diplomat::result compare(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to) const; - inline diplomat::result compare_with_provider(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result compare_with_provider(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const; - inline diplomat::result total(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to) const; + inline temporal_rs::diplomat::result total(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to) const; - inline diplomat::result total_with_provider(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result total_with_provider(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const; inline std::unique_ptr clone() const; - inline const temporal_rs::capi::Duration* AsFFI() const; - inline temporal_rs::capi::Duration* AsFFI(); - inline static const temporal_rs::Duration* FromFFI(const temporal_rs::capi::Duration* ptr); - inline static temporal_rs::Duration* FromFFI(temporal_rs::capi::Duration* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::Duration* AsFFI() const; + inline temporal_rs::capi::Duration* AsFFI(); + inline static const temporal_rs::Duration* FromFFI(const temporal_rs::capi::Duration* ptr); + inline static temporal_rs::Duration* FromFFI(temporal_rs::capi::Duration* ptr); + inline static void operator delete(void* ptr); private: - Duration() = delete; - Duration(const temporal_rs::Duration&) = delete; - Duration(temporal_rs::Duration&&) noexcept = delete; - Duration operator=(const temporal_rs::Duration&) = delete; - Duration operator=(temporal_rs::Duration&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + Duration() = delete; + Duration(const temporal_rs::Duration&) = delete; + Duration(temporal_rs::Duration&&) noexcept = delete; + Duration operator=(const temporal_rs::Duration&) = delete; + Duration operator=(temporal_rs::Duration&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_Duration_D_HPP +#endif // TEMPORAL_RS_Duration_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Duration.hpp b/temporal_capi/bindings/cpp/temporal_rs/Duration.hpp index fa80abd4a..af3f0cd44 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Duration.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Duration.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Duration_HPP -#define temporal_rs_Duration_HPP +#ifndef TEMPORAL_RS_Duration_HPP +#define TEMPORAL_RS_Duration_HPP #include "Duration.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PartialDuration.hpp" #include "Provider.hpp" #include "RelativeTo.hpp" @@ -20,6 +19,7 @@ #include "TemporalError.hpp" #include "ToStringRoundingOptions.hpp" #include "Unit.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -36,10 +36,10 @@ namespace capi { temporal_rs_Duration_from_partial_duration_result temporal_rs_Duration_from_partial_duration(temporal_rs::capi::PartialDuration partial); typedef struct temporal_rs_Duration_from_utf8_result {union {temporal_rs::capi::Duration* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Duration_from_utf8_result; - temporal_rs_Duration_from_utf8_result temporal_rs_Duration_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_Duration_from_utf8_result temporal_rs_Duration_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_Duration_from_utf16_result {union {temporal_rs::capi::Duration* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Duration_from_utf16_result; - temporal_rs_Duration_from_utf16_result temporal_rs_Duration_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_Duration_from_utf16_result temporal_rs_Duration_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); bool temporal_rs_Duration_is_time_within_range(const temporal_rs::capi::Duration* self); @@ -78,7 +78,7 @@ namespace capi { temporal_rs_Duration_subtract_result temporal_rs_Duration_subtract(const temporal_rs::capi::Duration* self, const temporal_rs::capi::Duration* other); typedef struct temporal_rs_Duration_to_string_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Duration_to_string_result; - temporal_rs_Duration_to_string_result temporal_rs_Duration_to_string(const temporal_rs::capi::Duration* self, temporal_rs::capi::ToStringRoundingOptions options, diplomat::capi::DiplomatWrite* write); + temporal_rs_Duration_to_string_result temporal_rs_Duration_to_string(const temporal_rs::capi::Duration* self, temporal_rs::capi::ToStringRoundingOptions options, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_Duration_round_result {union {temporal_rs::capi::Duration* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Duration_round_result; temporal_rs_Duration_round_result temporal_rs_Duration_round(const temporal_rs::capi::Duration* self, temporal_rs::capi::RoundingOptions options, temporal_rs::capi::RelativeTo relative_to); @@ -106,222 +106,222 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::create(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds) { - auto result = temporal_rs::capi::temporal_rs_Duration_create(years, - months, - weeks, - days, - hours, - minutes, - seconds, - milliseconds, - microseconds, - nanoseconds); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::create(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds) { + auto result = temporal_rs::capi::temporal_rs_Duration_create(years, + months, + weeks, + days, + hours, + minutes, + seconds, + milliseconds, + microseconds, + nanoseconds); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::try_new(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds) { - auto result = temporal_rs::capi::temporal_rs_Duration_try_new(years, - months, - weeks, - days, - hours, - minutes, - seconds, - milliseconds, - microseconds, - nanoseconds); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::try_new(int64_t years, int64_t months, int64_t weeks, int64_t days, int64_t hours, int64_t minutes, int64_t seconds, int64_t milliseconds, double microseconds, double nanoseconds) { + auto result = temporal_rs::capi::temporal_rs_Duration_try_new(years, + months, + weeks, + days, + hours, + minutes, + seconds, + milliseconds, + microseconds, + nanoseconds); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::from_partial_duration(temporal_rs::PartialDuration partial) { - auto result = temporal_rs::capi::temporal_rs_Duration_from_partial_duration(partial.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::from_partial_duration(temporal_rs::PartialDuration partial) { + auto result = temporal_rs::capi::temporal_rs_Duration_from_partial_duration(partial.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_Duration_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_Duration_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_Duration_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_Duration_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::Duration::is_time_within_range() const { - auto result = temporal_rs::capi::temporal_rs_Duration_is_time_within_range(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_is_time_within_range(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::years() const { - auto result = temporal_rs::capi::temporal_rs_Duration_years(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_years(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::months() const { - auto result = temporal_rs::capi::temporal_rs_Duration_months(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_months(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::weeks() const { - auto result = temporal_rs::capi::temporal_rs_Duration_weeks(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_weeks(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::days() const { - auto result = temporal_rs::capi::temporal_rs_Duration_days(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_days(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::hours() const { - auto result = temporal_rs::capi::temporal_rs_Duration_hours(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_hours(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::minutes() const { - auto result = temporal_rs::capi::temporal_rs_Duration_minutes(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_minutes(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::seconds() const { - auto result = temporal_rs::capi::temporal_rs_Duration_seconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_seconds(this->AsFFI()); + return result; } inline int64_t temporal_rs::Duration::milliseconds() const { - auto result = temporal_rs::capi::temporal_rs_Duration_milliseconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_milliseconds(this->AsFFI()); + return result; } inline double temporal_rs::Duration::microseconds() const { - auto result = temporal_rs::capi::temporal_rs_Duration_microseconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_microseconds(this->AsFFI()); + return result; } inline double temporal_rs::Duration::nanoseconds() const { - auto result = temporal_rs::capi::temporal_rs_Duration_nanoseconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_nanoseconds(this->AsFFI()); + return result; } inline temporal_rs::Sign temporal_rs::Duration::sign() const { - auto result = temporal_rs::capi::temporal_rs_Duration_sign(this->AsFFI()); - return temporal_rs::Sign::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_Duration_sign(this->AsFFI()); + return temporal_rs::Sign::FromFFI(result); } inline bool temporal_rs::Duration::is_zero() const { - auto result = temporal_rs::capi::temporal_rs_Duration_is_zero(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Duration_is_zero(this->AsFFI()); + return result; } inline std::unique_ptr temporal_rs::Duration::abs() const { - auto result = temporal_rs::capi::temporal_rs_Duration_abs(this->AsFFI()); - return std::unique_ptr(temporal_rs::Duration::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Duration_abs(this->AsFFI()); + return std::unique_ptr(temporal_rs::Duration::FromFFI(result)); } inline std::unique_ptr temporal_rs::Duration::negated() const { - auto result = temporal_rs::capi::temporal_rs_Duration_negated(this->AsFFI()); - return std::unique_ptr(temporal_rs::Duration::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Duration_negated(this->AsFFI()); + return std::unique_ptr(temporal_rs::Duration::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::add(const temporal_rs::Duration& other) const { - auto result = temporal_rs::capi::temporal_rs_Duration_add(this->AsFFI(), - other.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::add(const temporal_rs::Duration& other) const { + auto result = temporal_rs::capi::temporal_rs_Duration_add(this->AsFFI(), + other.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::subtract(const temporal_rs::Duration& other) const { - auto result = temporal_rs::capi::temporal_rs_Duration_subtract(this->AsFFI(), - other.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::subtract(const temporal_rs::Duration& other) const { + auto result = temporal_rs::capi::temporal_rs_Duration_subtract(this->AsFFI(), + other.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::Duration::to_string(temporal_rs::ToStringRoundingOptions options) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_Duration_to_string(this->AsFFI(), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Duration::to_string(temporal_rs::ToStringRoundingOptions options) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_Duration_to_string(this->AsFFI(), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::Duration::to_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_Duration_to_string(this->AsFFI(), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Duration::to_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_Duration_to_string(this->AsFFI(), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::round(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to) const { - auto result = temporal_rs::capi::temporal_rs_Duration_round(this->AsFFI(), - options.AsFFI(), - relative_to.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::round(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to) const { + auto result = temporal_rs::capi::temporal_rs_Duration_round(this->AsFFI(), + options.AsFFI(), + relative_to.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::round_with_provider(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_Duration_round_with_provider(this->AsFFI(), - options.AsFFI(), - relative_to.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Duration::round_with_provider(temporal_rs::RoundingOptions options, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_Duration_round_with_provider(this->AsFFI(), + options.AsFFI(), + relative_to.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::Duration::compare(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to) const { - auto result = temporal_rs::capi::temporal_rs_Duration_compare(this->AsFFI(), - other.AsFFI(), - relative_to.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Duration::compare(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to) const { + auto result = temporal_rs::capi::temporal_rs_Duration_compare(this->AsFFI(), + other.AsFFI(), + relative_to.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::Duration::compare_with_provider(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_Duration_compare_with_provider(this->AsFFI(), - other.AsFFI(), - relative_to.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Duration::compare_with_provider(const temporal_rs::Duration& other, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_Duration_compare_with_provider(this->AsFFI(), + other.AsFFI(), + relative_to.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::Duration::total(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to) const { - auto result = temporal_rs::capi::temporal_rs_Duration_total(this->AsFFI(), - unit.AsFFI(), - relative_to.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Duration::total(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to) const { + auto result = temporal_rs::capi::temporal_rs_Duration_total(this->AsFFI(), + unit.AsFFI(), + relative_to.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::Duration::total_with_provider(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_Duration_total_with_provider(this->AsFFI(), - unit.AsFFI(), - relative_to.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Duration::total_with_provider(temporal_rs::Unit unit, temporal_rs::RelativeTo relative_to, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_Duration_total_with_provider(this->AsFFI(), + unit.AsFFI(), + relative_to.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::Duration::clone() const { - auto result = temporal_rs::capi::temporal_rs_Duration_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::Duration::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Duration_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::Duration::FromFFI(result)); } inline const temporal_rs::capi::Duration* temporal_rs::Duration::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::Duration* temporal_rs::Duration::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::Duration* temporal_rs::Duration::FromFFI(const temporal_rs::capi::Duration* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::Duration* temporal_rs::Duration::FromFFI(temporal_rs::capi::Duration* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::Duration::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_Duration_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_Duration_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_Duration_HPP +#endif // TEMPORAL_RS_Duration_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.d.hpp index 218ae1c96..f6506bdec 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ErrorKind_D_HPP -#define temporal_rs_ErrorKind_D_HPP +#ifndef TEMPORAL_RS_ErrorKind_D_HPP +#define TEMPORAL_RS_ErrorKind_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -29,27 +29,27 @@ namespace capi { namespace temporal_rs { class ErrorKind { public: - enum Value { - Generic = 0, - Type = 1, - Range = 2, - Syntax = 3, - Assert = 4, - }; - - ErrorKind(): value(Value::Generic) {} - - // Implicit conversions between enum and ::Value - constexpr ErrorKind(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::ErrorKind AsFFI() const; - inline static temporal_rs::ErrorKind FromFFI(temporal_rs::capi::ErrorKind c_enum); + enum Value { + Generic = 0, + Type = 1, + Range = 2, + Syntax = 3, + Assert = 4, + }; + + ErrorKind(): value(Value::Generic) {} + + // Implicit conversions between enum and ::Value + constexpr ErrorKind(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::ErrorKind AsFFI() const; + inline static temporal_rs::ErrorKind FromFFI(temporal_rs::capi::ErrorKind c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_ErrorKind_D_HPP +#endif // TEMPORAL_RS_ErrorKind_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.hpp b/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.hpp index d79df1fb3..bb6ff87a3 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ErrorKind.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ErrorKind_HPP -#define temporal_rs_ErrorKind_HPP +#ifndef TEMPORAL_RS_ErrorKind_HPP +#define TEMPORAL_RS_ErrorKind_HPP #include "ErrorKind.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,19 +23,19 @@ namespace capi { } // namespace inline temporal_rs::capi::ErrorKind temporal_rs::ErrorKind::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::ErrorKind temporal_rs::ErrorKind::FromFFI(temporal_rs::capi::ErrorKind c_enum) { - switch (c_enum) { - case temporal_rs::capi::ErrorKind_Generic: - case temporal_rs::capi::ErrorKind_Type: - case temporal_rs::capi::ErrorKind_Range: - case temporal_rs::capi::ErrorKind_Syntax: - case temporal_rs::capi::ErrorKind_Assert: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::ErrorKind_Generic: + case temporal_rs::capi::ErrorKind_Type: + case temporal_rs::capi::ErrorKind_Range: + case temporal_rs::capi::ErrorKind_Syntax: + case temporal_rs::capi::ErrorKind_Assert: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_ErrorKind_HPP +#endif // TEMPORAL_RS_ErrorKind_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.d.hpp index 0a9a273d6..21119b414 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_I128Nanoseconds_D_HPP -#define temporal_rs_I128Nanoseconds_D_HPP +#ifndef TEMPORAL_RS_I128Nanoseconds_D_HPP +#define TEMPORAL_RS_I128Nanoseconds_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -34,14 +34,14 @@ namespace temporal_rs { * This could potentially instead be a bit-by-bit split, or something else */ struct I128Nanoseconds { - uint64_t high; - uint64_t low; + uint64_t high; + uint64_t low; inline bool is_valid() const; - inline temporal_rs::capi::I128Nanoseconds AsFFI() const; - inline static temporal_rs::I128Nanoseconds FromFFI(temporal_rs::capi::I128Nanoseconds c_struct); + inline temporal_rs::capi::I128Nanoseconds AsFFI() const; + inline static temporal_rs::I128Nanoseconds FromFFI(temporal_rs::capi::I128Nanoseconds c_struct); }; } // namespace -#endif // temporal_rs_I128Nanoseconds_D_HPP +#endif // TEMPORAL_RS_I128Nanoseconds_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.hpp b/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.hpp index 1e736be51..706d643cc 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/I128Nanoseconds.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_I128Nanoseconds_HPP -#define temporal_rs_I128Nanoseconds_HPP +#ifndef TEMPORAL_RS_I128Nanoseconds_HPP +#define TEMPORAL_RS_I128Nanoseconds_HPP #include "I128Nanoseconds.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -25,24 +25,24 @@ namespace capi { } // namespace inline bool temporal_rs::I128Nanoseconds::is_valid() const { - auto result = temporal_rs::capi::temporal_rs_I128Nanoseconds_is_valid(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_I128Nanoseconds_is_valid(this->AsFFI()); + return result; } inline temporal_rs::capi::I128Nanoseconds temporal_rs::I128Nanoseconds::AsFFI() const { - return temporal_rs::capi::I128Nanoseconds { - /* .high = */ high, - /* .low = */ low, - }; + return temporal_rs::capi::I128Nanoseconds { + /* .high = */ high, + /* .low = */ low, + }; } inline temporal_rs::I128Nanoseconds temporal_rs::I128Nanoseconds::FromFFI(temporal_rs::capi::I128Nanoseconds c_struct) { - return temporal_rs::I128Nanoseconds { - /* .high = */ c_struct.high, - /* .low = */ c_struct.low, - }; + return temporal_rs::I128Nanoseconds { + /* .high = */ c_struct.high, + /* .low = */ c_struct.low, + }; } -#endif // temporal_rs_I128Nanoseconds_HPP +#endif // TEMPORAL_RS_I128Nanoseconds_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Instant.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Instant.d.hpp index 999bb61ba..e6cff3029 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Instant.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Instant.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Instant_D_HPP -#define temporal_rs_Instant_D_HPP +#ifndef TEMPORAL_RS_Instant_D_HPP +#define TEMPORAL_RS_Instant_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Duration; } class Duration; @@ -26,7 +25,8 @@ struct RoundingOptions; struct TemporalError; struct TimeZone; struct ToStringRoundingOptions; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -39,23 +39,23 @@ namespace temporal_rs { class Instant { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new(temporal_rs::I128Nanoseconds ns); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(temporal_rs::I128Nanoseconds ns); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t epoch_milliseconds); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t epoch_milliseconds); - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration) const; - inline diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; inline int8_t compare(const temporal_rs::Instant& other) const; @@ -65,33 +65,33 @@ class Instant { inline temporal_rs::I128Nanoseconds epoch_nanoseconds() const; - inline diplomat::result to_ixdtf_string_with_compiled_data(std::optional zone, temporal_rs::ToStringRoundingOptions options) const; + inline temporal_rs::diplomat::result to_ixdtf_string_with_compiled_data(std::optional zone, temporal_rs::ToStringRoundingOptions options) const; template - inline diplomat::result to_ixdtf_string_with_compiled_data_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; + inline temporal_rs::diplomat::result to_ixdtf_string_with_compiled_data_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; - inline diplomat::result to_ixdtf_string_with_provider(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result to_ixdtf_string_with_provider(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const; template - inline diplomat::result to_ixdtf_string_with_provider_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable_output) const; + inline temporal_rs::diplomat::result to_ixdtf_string_with_provider_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable_output) const; - inline diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_iso(temporal_rs::TimeZone zone) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_iso(temporal_rs::TimeZone zone) const; - inline diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_iso_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_iso_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const; inline std::unique_ptr clone() const; - inline const temporal_rs::capi::Instant* AsFFI() const; - inline temporal_rs::capi::Instant* AsFFI(); - inline static const temporal_rs::Instant* FromFFI(const temporal_rs::capi::Instant* ptr); - inline static temporal_rs::Instant* FromFFI(temporal_rs::capi::Instant* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::Instant* AsFFI() const; + inline temporal_rs::capi::Instant* AsFFI(); + inline static const temporal_rs::Instant* FromFFI(const temporal_rs::capi::Instant* ptr); + inline static temporal_rs::Instant* FromFFI(temporal_rs::capi::Instant* ptr); + inline static void operator delete(void* ptr); private: - Instant() = delete; - Instant(const temporal_rs::Instant&) = delete; - Instant(temporal_rs::Instant&&) noexcept = delete; - Instant operator=(const temporal_rs::Instant&) = delete; - Instant operator=(temporal_rs::Instant&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + Instant() = delete; + Instant(const temporal_rs::Instant&) = delete; + Instant(temporal_rs::Instant&&) noexcept = delete; + Instant operator=(const temporal_rs::Instant&) = delete; + Instant operator=(temporal_rs::Instant&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_Instant_D_HPP +#endif // TEMPORAL_RS_Instant_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Instant.hpp b/temporal_capi/bindings/cpp/temporal_rs/Instant.hpp index 412dc55ce..7f260f5cf 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Instant.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Instant.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Instant_HPP -#define temporal_rs_Instant_HPP +#ifndef TEMPORAL_RS_Instant_HPP +#define TEMPORAL_RS_Instant_HPP #include "Instant.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "DifferenceSettings.hpp" #include "Duration.hpp" #include "I128Nanoseconds.hpp" @@ -21,6 +20,7 @@ #include "TimeZone.hpp" #include "ToStringRoundingOptions.hpp" #include "ZonedDateTime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -34,10 +34,10 @@ namespace capi { temporal_rs_Instant_from_epoch_milliseconds_result temporal_rs_Instant_from_epoch_milliseconds(int64_t epoch_milliseconds); typedef struct temporal_rs_Instant_from_utf8_result {union {temporal_rs::capi::Instant* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Instant_from_utf8_result; - temporal_rs_Instant_from_utf8_result temporal_rs_Instant_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_Instant_from_utf8_result temporal_rs_Instant_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_Instant_from_utf16_result {union {temporal_rs::capi::Instant* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Instant_from_utf16_result; - temporal_rs_Instant_from_utf16_result temporal_rs_Instant_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_Instant_from_utf16_result temporal_rs_Instant_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); typedef struct temporal_rs_Instant_add_result {union {temporal_rs::capi::Instant* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Instant_add_result; temporal_rs_Instant_add_result temporal_rs_Instant_add(const temporal_rs::capi::Instant* self, const temporal_rs::capi::Duration* duration); @@ -63,10 +63,10 @@ namespace capi { temporal_rs::capi::I128Nanoseconds temporal_rs_Instant_epoch_nanoseconds(const temporal_rs::capi::Instant* self); typedef struct temporal_rs_Instant_to_ixdtf_string_with_compiled_data_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Instant_to_ixdtf_string_with_compiled_data_result; - temporal_rs_Instant_to_ixdtf_string_with_compiled_data_result temporal_rs_Instant_to_ixdtf_string_with_compiled_data(const temporal_rs::capi::Instant* self, temporal_rs::capi::TimeZone_option zone, temporal_rs::capi::ToStringRoundingOptions options, diplomat::capi::DiplomatWrite* write); + temporal_rs_Instant_to_ixdtf_string_with_compiled_data_result temporal_rs_Instant_to_ixdtf_string_with_compiled_data(const temporal_rs::capi::Instant* self, temporal_rs::capi::TimeZone_option zone, temporal_rs::capi::ToStringRoundingOptions options, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_Instant_to_ixdtf_string_with_provider_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Instant_to_ixdtf_string_with_provider_result; - temporal_rs_Instant_to_ixdtf_string_with_provider_result temporal_rs_Instant_to_ixdtf_string_with_provider(const temporal_rs::capi::Instant* self, temporal_rs::capi::TimeZone_option zone, temporal_rs::capi::ToStringRoundingOptions options, const temporal_rs::capi::Provider* p, diplomat::capi::DiplomatWrite* write); + temporal_rs_Instant_to_ixdtf_string_with_provider_result temporal_rs_Instant_to_ixdtf_string_with_provider(const temporal_rs::capi::Instant* self, temporal_rs::capi::TimeZone_option zone, temporal_rs::capi::ToStringRoundingOptions options, const temporal_rs::capi::Provider* p, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_Instant_to_zoned_date_time_iso_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_Instant_to_zoned_date_time_iso_result; temporal_rs_Instant_to_zoned_date_time_iso_result temporal_rs_Instant_to_zoned_date_time_iso(const temporal_rs::capi::Instant* self, temporal_rs::capi::TimeZone zone); @@ -82,157 +82,157 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::try_new(temporal_rs::I128Nanoseconds ns) { - auto result = temporal_rs::capi::temporal_rs_Instant_try_new(ns.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::try_new(temporal_rs::I128Nanoseconds ns) { + auto result = temporal_rs::capi::temporal_rs_Instant_try_new(ns.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::from_epoch_milliseconds(int64_t epoch_milliseconds) { - auto result = temporal_rs::capi::temporal_rs_Instant_from_epoch_milliseconds(epoch_milliseconds); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::from_epoch_milliseconds(int64_t epoch_milliseconds) { + auto result = temporal_rs::capi::temporal_rs_Instant_from_epoch_milliseconds(epoch_milliseconds); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_Instant_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_Instant_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_Instant_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_Instant_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::add(const temporal_rs::Duration& duration) const { - auto result = temporal_rs::capi::temporal_rs_Instant_add(this->AsFFI(), - duration.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::add(const temporal_rs::Duration& duration) const { + auto result = temporal_rs::capi::temporal_rs_Instant_add(this->AsFFI(), + duration.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::subtract(const temporal_rs::Duration& duration) const { - auto result = temporal_rs::capi::temporal_rs_Instant_subtract(this->AsFFI(), - duration.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::subtract(const temporal_rs::Duration& duration) const { + auto result = temporal_rs::capi::temporal_rs_Instant_subtract(this->AsFFI(), + duration.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::since(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_Instant_since(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::since(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_Instant_since(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::until(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_Instant_until(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::until(const temporal_rs::Instant& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_Instant_until(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::round(temporal_rs::RoundingOptions options) const { - auto result = temporal_rs::capi::temporal_rs_Instant_round(this->AsFFI(), - options.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::round(temporal_rs::RoundingOptions options) const { + auto result = temporal_rs::capi::temporal_rs_Instant_round(this->AsFFI(), + options.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Instant::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline int8_t temporal_rs::Instant::compare(const temporal_rs::Instant& other) const { - auto result = temporal_rs::capi::temporal_rs_Instant_compare(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Instant_compare(this->AsFFI(), + other.AsFFI()); + return result; } inline bool temporal_rs::Instant::equals(const temporal_rs::Instant& other) const { - auto result = temporal_rs::capi::temporal_rs_Instant_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Instant_equals(this->AsFFI(), + other.AsFFI()); + return result; } inline int64_t temporal_rs::Instant::epoch_milliseconds() const { - auto result = temporal_rs::capi::temporal_rs_Instant_epoch_milliseconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_Instant_epoch_milliseconds(this->AsFFI()); + return result; } inline temporal_rs::I128Nanoseconds temporal_rs::Instant::epoch_nanoseconds() const { - auto result = temporal_rs::capi::temporal_rs_Instant_epoch_nanoseconds(this->AsFFI()); - return temporal_rs::I128Nanoseconds::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_Instant_epoch_nanoseconds(this->AsFFI()); + return temporal_rs::I128Nanoseconds::FromFFI(result); } -inline diplomat::result temporal_rs::Instant::to_ixdtf_string_with_compiled_data(std::optional zone, temporal_rs::ToStringRoundingOptions options) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_compiled_data(this->AsFFI(), - zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Instant::to_ixdtf_string_with_compiled_data(std::optional zone, temporal_rs::ToStringRoundingOptions options) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_compiled_data(this->AsFFI(), + zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::Instant::to_ixdtf_string_with_compiled_data_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_compiled_data(this->AsFFI(), - zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); -} - -inline diplomat::result temporal_rs::Instant::to_ixdtf_string_with_provider(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_provider(this->AsFFI(), - zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), - options.AsFFI(), - p.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Instant::to_ixdtf_string_with_compiled_data_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_compiled_data(this->AsFFI(), + zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +} + +inline temporal_rs::diplomat::result temporal_rs::Instant::to_ixdtf_string_with_provider(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_provider(this->AsFFI(), + zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), + options.AsFFI(), + p.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::Instant::to_ixdtf_string_with_provider_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_provider(this->AsFFI(), - zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), - options.AsFFI(), - p.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::Instant::to_ixdtf_string_with_provider_write(std::optional zone, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_Instant_to_ixdtf_string_with_provider(this->AsFFI(), + zone.has_value() ? (temporal_rs::capi::TimeZone_option{ { zone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), + options.AsFFI(), + p.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::to_zoned_date_time_iso(temporal_rs::TimeZone zone) const { - auto result = temporal_rs::capi::temporal_rs_Instant_to_zoned_date_time_iso(this->AsFFI(), - zone.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::to_zoned_date_time_iso(temporal_rs::TimeZone zone) const { + auto result = temporal_rs::capi::temporal_rs_Instant_to_zoned_date_time_iso(this->AsFFI(), + zone.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::to_zoned_date_time_iso_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_Instant_to_zoned_date_time_iso_with_provider(this->AsFFI(), - zone.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::Instant::to_zoned_date_time_iso_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_Instant_to_zoned_date_time_iso_with_provider(this->AsFFI(), + zone.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::Instant::clone() const { - auto result = temporal_rs::capi::temporal_rs_Instant_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::Instant::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Instant_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::Instant::FromFFI(result)); } inline const temporal_rs::capi::Instant* temporal_rs::Instant::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::Instant* temporal_rs::Instant::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::Instant* temporal_rs::Instant::FromFFI(const temporal_rs::capi::Instant* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::Instant* temporal_rs::Instant::FromFFI(temporal_rs::capi::Instant* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::Instant::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_Instant_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_Instant_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_Instant_HPP +#endif // TEMPORAL_RS_Instant_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.d.hpp index bdfb465bf..b39f3cd9e 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_OffsetDisambiguation_D_HPP -#define temporal_rs_OffsetDisambiguation_D_HPP +#ifndef TEMPORAL_RS_OffsetDisambiguation_D_HPP +#define TEMPORAL_RS_OffsetDisambiguation_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -28,26 +28,26 @@ namespace capi { namespace temporal_rs { class OffsetDisambiguation { public: - enum Value { - Use = 0, - Prefer = 1, - Ignore = 2, - Reject = 3, - }; - - OffsetDisambiguation(): value(Value::Use) {} - - // Implicit conversions between enum and ::Value - constexpr OffsetDisambiguation(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::OffsetDisambiguation AsFFI() const; - inline static temporal_rs::OffsetDisambiguation FromFFI(temporal_rs::capi::OffsetDisambiguation c_enum); + enum Value { + Use = 0, + Prefer = 1, + Ignore = 2, + Reject = 3, + }; + + OffsetDisambiguation(): value(Value::Use) {} + + // Implicit conversions between enum and ::Value + constexpr OffsetDisambiguation(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::OffsetDisambiguation AsFFI() const; + inline static temporal_rs::OffsetDisambiguation FromFFI(temporal_rs::capi::OffsetDisambiguation c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_OffsetDisambiguation_D_HPP +#endif // TEMPORAL_RS_OffsetDisambiguation_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.hpp b/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.hpp index 71fd5babd..46313f67c 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/OffsetDisambiguation.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_OffsetDisambiguation_HPP -#define temporal_rs_OffsetDisambiguation_HPP +#ifndef TEMPORAL_RS_OffsetDisambiguation_HPP +#define TEMPORAL_RS_OffsetDisambiguation_HPP #include "OffsetDisambiguation.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,18 +23,18 @@ namespace capi { } // namespace inline temporal_rs::capi::OffsetDisambiguation temporal_rs::OffsetDisambiguation::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::OffsetDisambiguation temporal_rs::OffsetDisambiguation::FromFFI(temporal_rs::capi::OffsetDisambiguation c_enum) { - switch (c_enum) { - case temporal_rs::capi::OffsetDisambiguation_Use: - case temporal_rs::capi::OffsetDisambiguation_Prefer: - case temporal_rs::capi::OffsetDisambiguation_Ignore: - case temporal_rs::capi::OffsetDisambiguation_Reject: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::OffsetDisambiguation_Use: + case temporal_rs::capi::OffsetDisambiguation_Prefer: + case temporal_rs::capi::OffsetDisambiguation_Ignore: + case temporal_rs::capi::OffsetDisambiguation_Reject: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_OffsetDisambiguation_HPP +#endif // TEMPORAL_RS_OffsetDisambiguation_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.d.hpp index 58b0289eb..27fb77ef3 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_OwnedRelativeTo_D_HPP -#define temporal_rs_OwnedRelativeTo_D_HPP +#ifndef TEMPORAL_RS_OwnedRelativeTo_D_HPP +#define TEMPORAL_RS_OwnedRelativeTo_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct PlainDate; } class PlainDate; @@ -20,7 +19,8 @@ namespace capi { struct ZonedDateTime; } class ZonedDateTime; struct OwnedRelativeTo; struct TemporalError; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -41,22 +41,22 @@ namespace temporal_rs { * we need a way to produce that result. */ struct OwnedRelativeTo { - std::unique_ptr date; - std::unique_ptr zoned; + std::unique_ptr date; + std::unique_ptr zoned; - inline static diplomat::result from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result from_utf8(std::string_view s); - inline static diplomat::result from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p); - inline static diplomat::result from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result from_utf16(std::u16string_view s); - inline static diplomat::result from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p); inline static temporal_rs::OwnedRelativeTo empty(); - inline temporal_rs::capi::OwnedRelativeTo AsFFI() const; - inline static temporal_rs::OwnedRelativeTo FromFFI(temporal_rs::capi::OwnedRelativeTo c_struct); + inline temporal_rs::capi::OwnedRelativeTo AsFFI() const; + inline static temporal_rs::OwnedRelativeTo FromFFI(temporal_rs::capi::OwnedRelativeTo c_struct); }; } // namespace -#endif // temporal_rs_OwnedRelativeTo_D_HPP +#endif // TEMPORAL_RS_OwnedRelativeTo_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.hpp b/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.hpp index a20e45d50..4ba8b6554 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/OwnedRelativeTo.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_OwnedRelativeTo_HPP -#define temporal_rs_OwnedRelativeTo_HPP +#ifndef TEMPORAL_RS_OwnedRelativeTo_HPP +#define TEMPORAL_RS_OwnedRelativeTo_HPP #include "OwnedRelativeTo.d.hpp" @@ -11,11 +11,11 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PlainDate.hpp" #include "Provider.hpp" #include "TemporalError.hpp" #include "ZonedDateTime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,16 +23,16 @@ namespace capi { extern "C" { typedef struct temporal_rs_OwnedRelativeTo_from_utf8_result {union {temporal_rs::capi::OwnedRelativeTo ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_OwnedRelativeTo_from_utf8_result; - temporal_rs_OwnedRelativeTo_from_utf8_result temporal_rs_OwnedRelativeTo_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_OwnedRelativeTo_from_utf8_result temporal_rs_OwnedRelativeTo_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_OwnedRelativeTo_from_utf8_with_provider_result {union {temporal_rs::capi::OwnedRelativeTo ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_OwnedRelativeTo_from_utf8_with_provider_result; - temporal_rs_OwnedRelativeTo_from_utf8_with_provider_result temporal_rs_OwnedRelativeTo_from_utf8_with_provider(diplomat::capi::DiplomatStringView s, const temporal_rs::capi::Provider* p); + temporal_rs_OwnedRelativeTo_from_utf8_with_provider_result temporal_rs_OwnedRelativeTo_from_utf8_with_provider(temporal_rs::diplomat::capi::DiplomatStringView s, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_OwnedRelativeTo_from_utf16_result {union {temporal_rs::capi::OwnedRelativeTo ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_OwnedRelativeTo_from_utf16_result; - temporal_rs_OwnedRelativeTo_from_utf16_result temporal_rs_OwnedRelativeTo_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_OwnedRelativeTo_from_utf16_result temporal_rs_OwnedRelativeTo_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); typedef struct temporal_rs_OwnedRelativeTo_from_utf16_with_provider_result {union {temporal_rs::capi::OwnedRelativeTo ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_OwnedRelativeTo_from_utf16_with_provider_result; - temporal_rs_OwnedRelativeTo_from_utf16_with_provider_result temporal_rs_OwnedRelativeTo_from_utf16_with_provider(diplomat::capi::DiplomatString16View s, const temporal_rs::capi::Provider* p); + temporal_rs_OwnedRelativeTo_from_utf16_with_provider_result temporal_rs_OwnedRelativeTo_from_utf16_with_provider(temporal_rs::diplomat::capi::DiplomatString16View s, const temporal_rs::capi::Provider* p); temporal_rs::capi::OwnedRelativeTo temporal_rs_OwnedRelativeTo_empty(void); @@ -40,47 +40,47 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result temporal_rs::OwnedRelativeTo::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::OwnedRelativeTo::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::OwnedRelativeTo::from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf8_with_provider({s.data(), s.size()}, - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::OwnedRelativeTo::from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf8_with_provider({s.data(), s.size()}, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::OwnedRelativeTo::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::OwnedRelativeTo::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::OwnedRelativeTo::from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf16_with_provider({s.data(), s.size()}, - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::OwnedRelativeTo::from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_from_utf16_with_provider({s.data(), s.size()}, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::OwnedRelativeTo::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline temporal_rs::OwnedRelativeTo temporal_rs::OwnedRelativeTo::empty() { - auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_empty(); - return temporal_rs::OwnedRelativeTo::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_OwnedRelativeTo_empty(); + return temporal_rs::OwnedRelativeTo::FromFFI(result); } inline temporal_rs::capi::OwnedRelativeTo temporal_rs::OwnedRelativeTo::AsFFI() const { - return temporal_rs::capi::OwnedRelativeTo { - /* .date = */ date ? date->AsFFI() : nullptr, - /* .zoned = */ zoned ? zoned->AsFFI() : nullptr, - }; + return temporal_rs::capi::OwnedRelativeTo { + /* .date = */ date ? date->AsFFI() : nullptr, + /* .zoned = */ zoned ? zoned->AsFFI() : nullptr, + }; } inline temporal_rs::OwnedRelativeTo temporal_rs::OwnedRelativeTo::FromFFI(temporal_rs::capi::OwnedRelativeTo c_struct) { - return temporal_rs::OwnedRelativeTo { - /* .date = */ std::unique_ptr(temporal_rs::PlainDate::FromFFI(c_struct.date)), - /* .zoned = */ std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(c_struct.zoned)), - }; + return temporal_rs::OwnedRelativeTo { + /* .date = */ std::unique_ptr(temporal_rs::PlainDate::FromFFI(c_struct.date)), + /* .zoned = */ std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(c_struct.zoned)), + }; } -#endif // temporal_rs_OwnedRelativeTo_HPP +#endif // TEMPORAL_RS_OwnedRelativeTo_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.d.hpp index 6a92b8ac0..6e3327c00 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ParsedDate_D_HPP -#define temporal_rs_ParsedDate_D_HPP +#ifndef TEMPORAL_RS_ParsedDate_D_HPP +#define TEMPORAL_RS_ParsedDate_D_HPP #include #include @@ -9,13 +9,13 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct ParsedDate; } class ParsedDate; struct TemporalError; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -28,31 +28,31 @@ namespace temporal_rs { class ParsedDate { public: - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); - inline static diplomat::result, temporal_rs::TemporalError> year_month_from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> year_month_from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> year_month_from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> year_month_from_utf16(std::u16string_view s); - inline static diplomat::result, temporal_rs::TemporalError> month_day_from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> month_day_from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> month_day_from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> month_day_from_utf16(std::u16string_view s); - inline const temporal_rs::capi::ParsedDate* AsFFI() const; - inline temporal_rs::capi::ParsedDate* AsFFI(); - inline static const temporal_rs::ParsedDate* FromFFI(const temporal_rs::capi::ParsedDate* ptr); - inline static temporal_rs::ParsedDate* FromFFI(temporal_rs::capi::ParsedDate* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::ParsedDate* AsFFI() const; + inline temporal_rs::capi::ParsedDate* AsFFI(); + inline static const temporal_rs::ParsedDate* FromFFI(const temporal_rs::capi::ParsedDate* ptr); + inline static temporal_rs::ParsedDate* FromFFI(temporal_rs::capi::ParsedDate* ptr); + inline static void operator delete(void* ptr); private: - ParsedDate() = delete; - ParsedDate(const temporal_rs::ParsedDate&) = delete; - ParsedDate(temporal_rs::ParsedDate&&) noexcept = delete; - ParsedDate operator=(const temporal_rs::ParsedDate&) = delete; - ParsedDate operator=(temporal_rs::ParsedDate&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + ParsedDate() = delete; + ParsedDate(const temporal_rs::ParsedDate&) = delete; + ParsedDate(temporal_rs::ParsedDate&&) noexcept = delete; + ParsedDate operator=(const temporal_rs::ParsedDate&) = delete; + ParsedDate operator=(temporal_rs::ParsedDate&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_ParsedDate_D_HPP +#endif // TEMPORAL_RS_ParsedDate_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.hpp b/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.hpp index 22c8f2907..6a1494247 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ParsedDate.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ParsedDate_HPP -#define temporal_rs_ParsedDate_HPP +#ifndef TEMPORAL_RS_ParsedDate_HPP +#define TEMPORAL_RS_ParsedDate_HPP #include "ParsedDate.d.hpp" @@ -11,8 +11,8 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "TemporalError.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -20,22 +20,22 @@ namespace capi { extern "C" { typedef struct temporal_rs_ParsedDate_from_utf8_result {union {temporal_rs::capi::ParsedDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDate_from_utf8_result; - temporal_rs_ParsedDate_from_utf8_result temporal_rs_ParsedDate_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_ParsedDate_from_utf8_result temporal_rs_ParsedDate_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_ParsedDate_from_utf16_result {union {temporal_rs::capi::ParsedDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDate_from_utf16_result; - temporal_rs_ParsedDate_from_utf16_result temporal_rs_ParsedDate_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_ParsedDate_from_utf16_result temporal_rs_ParsedDate_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); typedef struct temporal_rs_ParsedDate_year_month_from_utf8_result {union {temporal_rs::capi::ParsedDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDate_year_month_from_utf8_result; - temporal_rs_ParsedDate_year_month_from_utf8_result temporal_rs_ParsedDate_year_month_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_ParsedDate_year_month_from_utf8_result temporal_rs_ParsedDate_year_month_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_ParsedDate_year_month_from_utf16_result {union {temporal_rs::capi::ParsedDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDate_year_month_from_utf16_result; - temporal_rs_ParsedDate_year_month_from_utf16_result temporal_rs_ParsedDate_year_month_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_ParsedDate_year_month_from_utf16_result temporal_rs_ParsedDate_year_month_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); typedef struct temporal_rs_ParsedDate_month_day_from_utf8_result {union {temporal_rs::capi::ParsedDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDate_month_day_from_utf8_result; - temporal_rs_ParsedDate_month_day_from_utf8_result temporal_rs_ParsedDate_month_day_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_ParsedDate_month_day_from_utf8_result temporal_rs_ParsedDate_month_day_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_ParsedDate_month_day_from_utf16_result {union {temporal_rs::capi::ParsedDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDate_month_day_from_utf16_result; - temporal_rs_ParsedDate_month_day_from_utf16_result temporal_rs_ParsedDate_month_day_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_ParsedDate_month_day_from_utf16_result temporal_rs_ParsedDate_month_day_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); void temporal_rs_ParsedDate_destroy(ParsedDate* self); @@ -43,55 +43,55 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDate_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDate_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDate_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDate_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::year_month_from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDate_year_month_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::year_month_from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDate_year_month_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::year_month_from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDate_year_month_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::year_month_from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDate_year_month_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::month_day_from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDate_month_day_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::month_day_from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDate_month_day_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::month_day_from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDate_month_day_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDate::month_day_from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDate_month_day_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline const temporal_rs::capi::ParsedDate* temporal_rs::ParsedDate::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::ParsedDate* temporal_rs::ParsedDate::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::ParsedDate* temporal_rs::ParsedDate::FromFFI(const temporal_rs::capi::ParsedDate* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::ParsedDate* temporal_rs::ParsedDate::FromFFI(temporal_rs::capi::ParsedDate* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::ParsedDate::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_ParsedDate_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_ParsedDate_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_ParsedDate_HPP +#endif // TEMPORAL_RS_ParsedDate_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.d.hpp index 07f41468e..aa8938252 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ParsedDateTime_D_HPP -#define temporal_rs_ParsedDateTime_D_HPP +#ifndef TEMPORAL_RS_ParsedDateTime_D_HPP +#define TEMPORAL_RS_ParsedDateTime_D_HPP #include #include @@ -9,13 +9,13 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct ParsedDateTime; } class ParsedDateTime; struct TemporalError; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -28,23 +28,23 @@ namespace temporal_rs { class ParsedDateTime { public: - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); - inline const temporal_rs::capi::ParsedDateTime* AsFFI() const; - inline temporal_rs::capi::ParsedDateTime* AsFFI(); - inline static const temporal_rs::ParsedDateTime* FromFFI(const temporal_rs::capi::ParsedDateTime* ptr); - inline static temporal_rs::ParsedDateTime* FromFFI(temporal_rs::capi::ParsedDateTime* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::ParsedDateTime* AsFFI() const; + inline temporal_rs::capi::ParsedDateTime* AsFFI(); + inline static const temporal_rs::ParsedDateTime* FromFFI(const temporal_rs::capi::ParsedDateTime* ptr); + inline static temporal_rs::ParsedDateTime* FromFFI(temporal_rs::capi::ParsedDateTime* ptr); + inline static void operator delete(void* ptr); private: - ParsedDateTime() = delete; - ParsedDateTime(const temporal_rs::ParsedDateTime&) = delete; - ParsedDateTime(temporal_rs::ParsedDateTime&&) noexcept = delete; - ParsedDateTime operator=(const temporal_rs::ParsedDateTime&) = delete; - ParsedDateTime operator=(temporal_rs::ParsedDateTime&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + ParsedDateTime() = delete; + ParsedDateTime(const temporal_rs::ParsedDateTime&) = delete; + ParsedDateTime(temporal_rs::ParsedDateTime&&) noexcept = delete; + ParsedDateTime operator=(const temporal_rs::ParsedDateTime&) = delete; + ParsedDateTime operator=(temporal_rs::ParsedDateTime&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_ParsedDateTime_D_HPP +#endif // TEMPORAL_RS_ParsedDateTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.hpp index 98eef079c..16b778094 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ParsedDateTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ParsedDateTime_HPP -#define temporal_rs_ParsedDateTime_HPP +#ifndef TEMPORAL_RS_ParsedDateTime_HPP +#define TEMPORAL_RS_ParsedDateTime_HPP #include "ParsedDateTime.d.hpp" @@ -11,8 +11,8 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "TemporalError.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -20,10 +20,10 @@ namespace capi { extern "C" { typedef struct temporal_rs_ParsedDateTime_from_utf8_result {union {temporal_rs::capi::ParsedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDateTime_from_utf8_result; - temporal_rs_ParsedDateTime_from_utf8_result temporal_rs_ParsedDateTime_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_ParsedDateTime_from_utf8_result temporal_rs_ParsedDateTime_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_ParsedDateTime_from_utf16_result {union {temporal_rs::capi::ParsedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedDateTime_from_utf16_result; - temporal_rs_ParsedDateTime_from_utf16_result temporal_rs_ParsedDateTime_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_ParsedDateTime_from_utf16_result temporal_rs_ParsedDateTime_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); void temporal_rs_ParsedDateTime_destroy(ParsedDateTime* self); @@ -31,35 +31,35 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDateTime::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDateTime_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDateTime::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDateTime_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDateTime::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedDateTime_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedDateTime::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedDateTime_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline const temporal_rs::capi::ParsedDateTime* temporal_rs::ParsedDateTime::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::ParsedDateTime* temporal_rs::ParsedDateTime::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::ParsedDateTime* temporal_rs::ParsedDateTime::FromFFI(const temporal_rs::capi::ParsedDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::ParsedDateTime* temporal_rs::ParsedDateTime::FromFFI(temporal_rs::capi::ParsedDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::ParsedDateTime::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_ParsedDateTime_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_ParsedDateTime_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_ParsedDateTime_HPP +#endif // TEMPORAL_RS_ParsedDateTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.d.hpp index ab84b5c2d..0f8b2c3e0 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ParsedZonedDateTime_D_HPP -#define temporal_rs_ParsedZonedDateTime_D_HPP +#ifndef TEMPORAL_RS_ParsedZonedDateTime_D_HPP +#define TEMPORAL_RS_ParsedZonedDateTime_D_HPP #include #include @@ -9,15 +9,15 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct ParsedZonedDateTime; } class ParsedZonedDateTime; namespace capi { struct Provider; } class Provider; struct TemporalError; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -30,27 +30,27 @@ namespace temporal_rs { class ParsedZonedDateTime { public: - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p); - inline const temporal_rs::capi::ParsedZonedDateTime* AsFFI() const; - inline temporal_rs::capi::ParsedZonedDateTime* AsFFI(); - inline static const temporal_rs::ParsedZonedDateTime* FromFFI(const temporal_rs::capi::ParsedZonedDateTime* ptr); - inline static temporal_rs::ParsedZonedDateTime* FromFFI(temporal_rs::capi::ParsedZonedDateTime* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::ParsedZonedDateTime* AsFFI() const; + inline temporal_rs::capi::ParsedZonedDateTime* AsFFI(); + inline static const temporal_rs::ParsedZonedDateTime* FromFFI(const temporal_rs::capi::ParsedZonedDateTime* ptr); + inline static temporal_rs::ParsedZonedDateTime* FromFFI(temporal_rs::capi::ParsedZonedDateTime* ptr); + inline static void operator delete(void* ptr); private: - ParsedZonedDateTime() = delete; - ParsedZonedDateTime(const temporal_rs::ParsedZonedDateTime&) = delete; - ParsedZonedDateTime(temporal_rs::ParsedZonedDateTime&&) noexcept = delete; - ParsedZonedDateTime operator=(const temporal_rs::ParsedZonedDateTime&) = delete; - ParsedZonedDateTime operator=(temporal_rs::ParsedZonedDateTime&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + ParsedZonedDateTime() = delete; + ParsedZonedDateTime(const temporal_rs::ParsedZonedDateTime&) = delete; + ParsedZonedDateTime(temporal_rs::ParsedZonedDateTime&&) noexcept = delete; + ParsedZonedDateTime operator=(const temporal_rs::ParsedZonedDateTime&) = delete; + ParsedZonedDateTime operator=(temporal_rs::ParsedZonedDateTime&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_ParsedZonedDateTime_D_HPP +#endif // TEMPORAL_RS_ParsedZonedDateTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.hpp index 3b3afd579..c8e95b2ad 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ParsedZonedDateTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ParsedZonedDateTime_HPP -#define temporal_rs_ParsedZonedDateTime_HPP +#ifndef TEMPORAL_RS_ParsedZonedDateTime_HPP +#define TEMPORAL_RS_ParsedZonedDateTime_HPP #include "ParsedZonedDateTime.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "Provider.hpp" #include "TemporalError.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -21,16 +21,16 @@ namespace capi { extern "C" { typedef struct temporal_rs_ParsedZonedDateTime_from_utf8_result {union {temporal_rs::capi::ParsedZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedZonedDateTime_from_utf8_result; - temporal_rs_ParsedZonedDateTime_from_utf8_result temporal_rs_ParsedZonedDateTime_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_ParsedZonedDateTime_from_utf8_result temporal_rs_ParsedZonedDateTime_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_ParsedZonedDateTime_from_utf8_with_provider_result {union {temporal_rs::capi::ParsedZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedZonedDateTime_from_utf8_with_provider_result; - temporal_rs_ParsedZonedDateTime_from_utf8_with_provider_result temporal_rs_ParsedZonedDateTime_from_utf8_with_provider(diplomat::capi::DiplomatStringView s, const temporal_rs::capi::Provider* p); + temporal_rs_ParsedZonedDateTime_from_utf8_with_provider_result temporal_rs_ParsedZonedDateTime_from_utf8_with_provider(temporal_rs::diplomat::capi::DiplomatStringView s, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_ParsedZonedDateTime_from_utf16_result {union {temporal_rs::capi::ParsedZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedZonedDateTime_from_utf16_result; - temporal_rs_ParsedZonedDateTime_from_utf16_result temporal_rs_ParsedZonedDateTime_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_ParsedZonedDateTime_from_utf16_result temporal_rs_ParsedZonedDateTime_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); typedef struct temporal_rs_ParsedZonedDateTime_from_utf16_with_provider_result {union {temporal_rs::capi::ParsedZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ParsedZonedDateTime_from_utf16_with_provider_result; - temporal_rs_ParsedZonedDateTime_from_utf16_with_provider_result temporal_rs_ParsedZonedDateTime_from_utf16_with_provider(diplomat::capi::DiplomatString16View s, const temporal_rs::capi::Provider* p); + temporal_rs_ParsedZonedDateTime_from_utf16_with_provider_result temporal_rs_ParsedZonedDateTime_from_utf16_with_provider(temporal_rs::diplomat::capi::DiplomatString16View s, const temporal_rs::capi::Provider* p); void temporal_rs_ParsedZonedDateTime_destroy(ParsedZonedDateTime* self); @@ -38,47 +38,47 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf8_with_provider({s.data(), s.size()}, - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf8_with_provider(std::string_view s, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf8_with_provider({s.data(), s.size()}, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf16_with_provider({s.data(), s.size()}, - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ParsedZonedDateTime::from_utf16_with_provider(std::u16string_view s, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ParsedZonedDateTime_from_utf16_with_provider({s.data(), s.size()}, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ParsedZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline const temporal_rs::capi::ParsedZonedDateTime* temporal_rs::ParsedZonedDateTime::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::ParsedZonedDateTime* temporal_rs::ParsedZonedDateTime::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::ParsedZonedDateTime* temporal_rs::ParsedZonedDateTime::FromFFI(const temporal_rs::capi::ParsedZonedDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::ParsedZonedDateTime* temporal_rs::ParsedZonedDateTime::FromFFI(temporal_rs::capi::ParsedZonedDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::ParsedZonedDateTime::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_ParsedZonedDateTime_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_ParsedZonedDateTime_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_ParsedZonedDateTime_HPP +#endif // TEMPORAL_RS_ParsedZonedDateTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialDate.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialDate.d.hpp index 69296c906..781c7b0c9 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialDate.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialDate.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialDate_D_HPP -#define temporal_rs_PartialDate_D_HPP +#ifndef TEMPORAL_RS_PartialDate_D_HPP +#define TEMPORAL_RS_PartialDate_D_HPP #include #include @@ -9,23 +9,23 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { class AnyCalendarKind; -} +} // namespace temporal_rs + namespace temporal_rs { namespace capi { struct PartialDate { - diplomat::capi::OptionI32 year; - diplomat::capi::OptionU8 month; - diplomat::capi::DiplomatStringView month_code; - diplomat::capi::OptionU8 day; - diplomat::capi::DiplomatStringView era; - diplomat::capi::OptionI32 era_year; + temporal_rs::diplomat::capi::OptionI32 year; + temporal_rs::diplomat::capi::OptionU8 month; + temporal_rs::diplomat::capi::DiplomatStringView month_code; + temporal_rs::diplomat::capi::OptionU8 day; + temporal_rs::diplomat::capi::DiplomatStringView era; + temporal_rs::diplomat::capi::OptionI32 era_year; temporal_rs::capi::AnyCalendarKind calendar; }; @@ -36,17 +36,17 @@ namespace capi { namespace temporal_rs { struct PartialDate { - std::optional year; - std::optional month; - std::string_view month_code; - std::optional day; - std::string_view era; - std::optional era_year; - temporal_rs::AnyCalendarKind calendar; - - inline temporal_rs::capi::PartialDate AsFFI() const; - inline static temporal_rs::PartialDate FromFFI(temporal_rs::capi::PartialDate c_struct); + std::optional year; + std::optional month; + std::string_view month_code; + std::optional day; + std::string_view era; + std::optional era_year; + temporal_rs::AnyCalendarKind calendar; + + inline temporal_rs::capi::PartialDate AsFFI() const; + inline static temporal_rs::PartialDate FromFFI(temporal_rs::capi::PartialDate c_struct); }; } // namespace -#endif // temporal_rs_PartialDate_D_HPP +#endif // TEMPORAL_RS_PartialDate_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialDate.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialDate.hpp index b983bb359..b7b9dc439 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialDate.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialDate.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialDate_HPP -#define temporal_rs_PartialDate_HPP +#ifndef TEMPORAL_RS_PartialDate_HPP +#define TEMPORAL_RS_PartialDate_HPP #include "PartialDate.d.hpp" @@ -11,8 +11,8 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -25,28 +25,28 @@ namespace capi { inline temporal_rs::capi::PartialDate temporal_rs::PartialDate::AsFFI() const { - return temporal_rs::capi::PartialDate { - /* .year = */ year.has_value() ? (diplomat::capi::OptionI32{ { year.value() }, true }) : (diplomat::capi::OptionI32{ {}, false }), - /* .month = */ month.has_value() ? (diplomat::capi::OptionU8{ { month.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - /* .month_code = */ {month_code.data(), month_code.size()}, - /* .day = */ day.has_value() ? (diplomat::capi::OptionU8{ { day.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - /* .era = */ {era.data(), era.size()}, - /* .era_year = */ era_year.has_value() ? (diplomat::capi::OptionI32{ { era_year.value() }, true }) : (diplomat::capi::OptionI32{ {}, false }), - /* .calendar = */ calendar.AsFFI(), - }; + return temporal_rs::capi::PartialDate { + /* .year = */ year.has_value() ? (temporal_rs::diplomat::capi::OptionI32{ { year.value() }, true }) : (temporal_rs::diplomat::capi::OptionI32{ {}, false }), + /* .month = */ month.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { month.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + /* .month_code = */ {month_code.data(), month_code.size()}, + /* .day = */ day.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { day.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + /* .era = */ {era.data(), era.size()}, + /* .era_year = */ era_year.has_value() ? (temporal_rs::diplomat::capi::OptionI32{ { era_year.value() }, true }) : (temporal_rs::diplomat::capi::OptionI32{ {}, false }), + /* .calendar = */ calendar.AsFFI(), + }; } inline temporal_rs::PartialDate temporal_rs::PartialDate::FromFFI(temporal_rs::capi::PartialDate c_struct) { - return temporal_rs::PartialDate { - /* .year = */ c_struct.year.is_ok ? std::optional(c_struct.year.ok) : std::nullopt, - /* .month = */ c_struct.month.is_ok ? std::optional(c_struct.month.ok) : std::nullopt, - /* .month_code = */ std::string_view(c_struct.month_code.data, c_struct.month_code.len), - /* .day = */ c_struct.day.is_ok ? std::optional(c_struct.day.ok) : std::nullopt, - /* .era = */ std::string_view(c_struct.era.data, c_struct.era.len), - /* .era_year = */ c_struct.era_year.is_ok ? std::optional(c_struct.era_year.ok) : std::nullopt, - /* .calendar = */ temporal_rs::AnyCalendarKind::FromFFI(c_struct.calendar), - }; + return temporal_rs::PartialDate { + /* .year = */ c_struct.year.is_ok ? std::optional(c_struct.year.ok) : std::nullopt, + /* .month = */ c_struct.month.is_ok ? std::optional(c_struct.month.ok) : std::nullopt, + /* .month_code = */ std::string_view(c_struct.month_code.data, c_struct.month_code.len), + /* .day = */ c_struct.day.is_ok ? std::optional(c_struct.day.ok) : std::nullopt, + /* .era = */ std::string_view(c_struct.era.data, c_struct.era.len), + /* .era_year = */ c_struct.era_year.is_ok ? std::optional(c_struct.era_year.ok) : std::nullopt, + /* .calendar = */ temporal_rs::AnyCalendarKind::FromFFI(c_struct.calendar), + }; } -#endif // temporal_rs_PartialDate_HPP +#endif // TEMPORAL_RS_PartialDate_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.d.hpp index e0439711c..31ef4d5b6 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialDateTime_D_HPP -#define temporal_rs_PartialDateTime_D_HPP +#ifndef TEMPORAL_RS_PartialDateTime_D_HPP +#define TEMPORAL_RS_PartialDateTime_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PartialDate.d.hpp" #include "PartialTime.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { struct PartialDate; struct PartialTime; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -33,12 +33,12 @@ namespace capi { namespace temporal_rs { struct PartialDateTime { - temporal_rs::PartialDate date; - temporal_rs::PartialTime time; + temporal_rs::PartialDate date; + temporal_rs::PartialTime time; - inline temporal_rs::capi::PartialDateTime AsFFI() const; - inline static temporal_rs::PartialDateTime FromFFI(temporal_rs::capi::PartialDateTime c_struct); + inline temporal_rs::capi::PartialDateTime AsFFI() const; + inline static temporal_rs::PartialDateTime FromFFI(temporal_rs::capi::PartialDateTime c_struct); }; } // namespace -#endif // temporal_rs_PartialDateTime_D_HPP +#endif // TEMPORAL_RS_PartialDateTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.hpp index f612dce0a..a1f79dc52 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialDateTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialDateTime_HPP -#define temporal_rs_PartialDateTime_HPP +#ifndef TEMPORAL_RS_PartialDateTime_HPP +#define TEMPORAL_RS_PartialDateTime_HPP #include "PartialDateTime.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PartialDate.hpp" #include "PartialTime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,18 +26,18 @@ namespace capi { inline temporal_rs::capi::PartialDateTime temporal_rs::PartialDateTime::AsFFI() const { - return temporal_rs::capi::PartialDateTime { - /* .date = */ date.AsFFI(), - /* .time = */ time.AsFFI(), - }; + return temporal_rs::capi::PartialDateTime { + /* .date = */ date.AsFFI(), + /* .time = */ time.AsFFI(), + }; } inline temporal_rs::PartialDateTime temporal_rs::PartialDateTime::FromFFI(temporal_rs::capi::PartialDateTime c_struct) { - return temporal_rs::PartialDateTime { - /* .date = */ temporal_rs::PartialDate::FromFFI(c_struct.date), - /* .time = */ temporal_rs::PartialTime::FromFFI(c_struct.time), - }; + return temporal_rs::PartialDateTime { + /* .date = */ temporal_rs::PartialDate::FromFFI(c_struct.date), + /* .time = */ temporal_rs::PartialTime::FromFFI(c_struct.time), + }; } -#endif // temporal_rs_PartialDateTime_HPP +#endif // TEMPORAL_RS_PartialDateTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.d.hpp index 347eff156..bac2b06bb 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialDuration_D_HPP -#define temporal_rs_PartialDuration_D_HPP +#ifndef TEMPORAL_RS_PartialDuration_D_HPP +#define TEMPORAL_RS_PartialDuration_D_HPP #include #include @@ -9,22 +9,22 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct PartialDuration { - diplomat::capi::OptionI64 years; - diplomat::capi::OptionI64 months; - diplomat::capi::OptionI64 weeks; - diplomat::capi::OptionI64 days; - diplomat::capi::OptionI64 hours; - diplomat::capi::OptionI64 minutes; - diplomat::capi::OptionI64 seconds; - diplomat::capi::OptionI64 milliseconds; - diplomat::capi::OptionF64 microseconds; - diplomat::capi::OptionF64 nanoseconds; + temporal_rs::diplomat::capi::OptionI64 years; + temporal_rs::diplomat::capi::OptionI64 months; + temporal_rs::diplomat::capi::OptionI64 weeks; + temporal_rs::diplomat::capi::OptionI64 days; + temporal_rs::diplomat::capi::OptionI64 hours; + temporal_rs::diplomat::capi::OptionI64 minutes; + temporal_rs::diplomat::capi::OptionI64 seconds; + temporal_rs::diplomat::capi::OptionI64 milliseconds; + temporal_rs::diplomat::capi::OptionF64 microseconds; + temporal_rs::diplomat::capi::OptionF64 nanoseconds; }; typedef struct PartialDuration_option {union { PartialDuration ok; }; bool is_ok; } PartialDuration_option; @@ -34,22 +34,22 @@ namespace capi { namespace temporal_rs { struct PartialDuration { - std::optional years; - std::optional months; - std::optional weeks; - std::optional days; - std::optional hours; - std::optional minutes; - std::optional seconds; - std::optional milliseconds; - std::optional microseconds; - std::optional nanoseconds; + std::optional years; + std::optional months; + std::optional weeks; + std::optional days; + std::optional hours; + std::optional minutes; + std::optional seconds; + std::optional milliseconds; + std::optional microseconds; + std::optional nanoseconds; inline bool is_empty() const; - inline temporal_rs::capi::PartialDuration AsFFI() const; - inline static temporal_rs::PartialDuration FromFFI(temporal_rs::capi::PartialDuration c_struct); + inline temporal_rs::capi::PartialDuration AsFFI() const; + inline static temporal_rs::PartialDuration FromFFI(temporal_rs::capi::PartialDuration c_struct); }; } // namespace -#endif // temporal_rs_PartialDuration_D_HPP +#endif // TEMPORAL_RS_PartialDuration_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.hpp index 8c31556bd..b73924d78 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialDuration.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialDuration_HPP -#define temporal_rs_PartialDuration_HPP +#ifndef TEMPORAL_RS_PartialDuration_HPP +#define TEMPORAL_RS_PartialDuration_HPP #include "PartialDuration.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -25,40 +25,40 @@ namespace capi { } // namespace inline bool temporal_rs::PartialDuration::is_empty() const { - auto result = temporal_rs::capi::temporal_rs_PartialDuration_is_empty(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PartialDuration_is_empty(this->AsFFI()); + return result; } inline temporal_rs::capi::PartialDuration temporal_rs::PartialDuration::AsFFI() const { - return temporal_rs::capi::PartialDuration { - /* .years = */ years.has_value() ? (diplomat::capi::OptionI64{ { years.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .months = */ months.has_value() ? (diplomat::capi::OptionI64{ { months.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .weeks = */ weeks.has_value() ? (diplomat::capi::OptionI64{ { weeks.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .days = */ days.has_value() ? (diplomat::capi::OptionI64{ { days.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .hours = */ hours.has_value() ? (diplomat::capi::OptionI64{ { hours.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .minutes = */ minutes.has_value() ? (diplomat::capi::OptionI64{ { minutes.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .seconds = */ seconds.has_value() ? (diplomat::capi::OptionI64{ { seconds.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .milliseconds = */ milliseconds.has_value() ? (diplomat::capi::OptionI64{ { milliseconds.value() }, true }) : (diplomat::capi::OptionI64{ {}, false }), - /* .microseconds = */ microseconds.has_value() ? (diplomat::capi::OptionF64{ { microseconds.value() }, true }) : (diplomat::capi::OptionF64{ {}, false }), - /* .nanoseconds = */ nanoseconds.has_value() ? (diplomat::capi::OptionF64{ { nanoseconds.value() }, true }) : (diplomat::capi::OptionF64{ {}, false }), - }; + return temporal_rs::capi::PartialDuration { + /* .years = */ years.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { years.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .months = */ months.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { months.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .weeks = */ weeks.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { weeks.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .days = */ days.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { days.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .hours = */ hours.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { hours.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .minutes = */ minutes.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { minutes.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .seconds = */ seconds.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { seconds.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .milliseconds = */ milliseconds.has_value() ? (temporal_rs::diplomat::capi::OptionI64{ { milliseconds.value() }, true }) : (temporal_rs::diplomat::capi::OptionI64{ {}, false }), + /* .microseconds = */ microseconds.has_value() ? (temporal_rs::diplomat::capi::OptionF64{ { microseconds.value() }, true }) : (temporal_rs::diplomat::capi::OptionF64{ {}, false }), + /* .nanoseconds = */ nanoseconds.has_value() ? (temporal_rs::diplomat::capi::OptionF64{ { nanoseconds.value() }, true }) : (temporal_rs::diplomat::capi::OptionF64{ {}, false }), + }; } inline temporal_rs::PartialDuration temporal_rs::PartialDuration::FromFFI(temporal_rs::capi::PartialDuration c_struct) { - return temporal_rs::PartialDuration { - /* .years = */ c_struct.years.is_ok ? std::optional(c_struct.years.ok) : std::nullopt, - /* .months = */ c_struct.months.is_ok ? std::optional(c_struct.months.ok) : std::nullopt, - /* .weeks = */ c_struct.weeks.is_ok ? std::optional(c_struct.weeks.ok) : std::nullopt, - /* .days = */ c_struct.days.is_ok ? std::optional(c_struct.days.ok) : std::nullopt, - /* .hours = */ c_struct.hours.is_ok ? std::optional(c_struct.hours.ok) : std::nullopt, - /* .minutes = */ c_struct.minutes.is_ok ? std::optional(c_struct.minutes.ok) : std::nullopt, - /* .seconds = */ c_struct.seconds.is_ok ? std::optional(c_struct.seconds.ok) : std::nullopt, - /* .milliseconds = */ c_struct.milliseconds.is_ok ? std::optional(c_struct.milliseconds.ok) : std::nullopt, - /* .microseconds = */ c_struct.microseconds.is_ok ? std::optional(c_struct.microseconds.ok) : std::nullopt, - /* .nanoseconds = */ c_struct.nanoseconds.is_ok ? std::optional(c_struct.nanoseconds.ok) : std::nullopt, - }; + return temporal_rs::PartialDuration { + /* .years = */ c_struct.years.is_ok ? std::optional(c_struct.years.ok) : std::nullopt, + /* .months = */ c_struct.months.is_ok ? std::optional(c_struct.months.ok) : std::nullopt, + /* .weeks = */ c_struct.weeks.is_ok ? std::optional(c_struct.weeks.ok) : std::nullopt, + /* .days = */ c_struct.days.is_ok ? std::optional(c_struct.days.ok) : std::nullopt, + /* .hours = */ c_struct.hours.is_ok ? std::optional(c_struct.hours.ok) : std::nullopt, + /* .minutes = */ c_struct.minutes.is_ok ? std::optional(c_struct.minutes.ok) : std::nullopt, + /* .seconds = */ c_struct.seconds.is_ok ? std::optional(c_struct.seconds.ok) : std::nullopt, + /* .milliseconds = */ c_struct.milliseconds.is_ok ? std::optional(c_struct.milliseconds.ok) : std::nullopt, + /* .microseconds = */ c_struct.microseconds.is_ok ? std::optional(c_struct.microseconds.ok) : std::nullopt, + /* .nanoseconds = */ c_struct.nanoseconds.is_ok ? std::optional(c_struct.nanoseconds.ok) : std::nullopt, + }; } -#endif // temporal_rs_PartialDuration_HPP +#endif // TEMPORAL_RS_PartialDuration_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialTime.d.hpp index 96ad7dbaf..7465f6b3b 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialTime_D_HPP -#define temporal_rs_PartialTime_D_HPP +#ifndef TEMPORAL_RS_PartialTime_D_HPP +#define TEMPORAL_RS_PartialTime_D_HPP #include #include @@ -9,18 +9,18 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct PartialTime { - diplomat::capi::OptionU8 hour; - diplomat::capi::OptionU8 minute; - diplomat::capi::OptionU8 second; - diplomat::capi::OptionU16 millisecond; - diplomat::capi::OptionU16 microsecond; - diplomat::capi::OptionU16 nanosecond; + temporal_rs::diplomat::capi::OptionU8 hour; + temporal_rs::diplomat::capi::OptionU8 minute; + temporal_rs::diplomat::capi::OptionU8 second; + temporal_rs::diplomat::capi::OptionU16 millisecond; + temporal_rs::diplomat::capi::OptionU16 microsecond; + temporal_rs::diplomat::capi::OptionU16 nanosecond; }; typedef struct PartialTime_option {union { PartialTime ok; }; bool is_ok; } PartialTime_option; @@ -30,16 +30,16 @@ namespace capi { namespace temporal_rs { struct PartialTime { - std::optional hour; - std::optional minute; - std::optional second; - std::optional millisecond; - std::optional microsecond; - std::optional nanosecond; - - inline temporal_rs::capi::PartialTime AsFFI() const; - inline static temporal_rs::PartialTime FromFFI(temporal_rs::capi::PartialTime c_struct); + std::optional hour; + std::optional minute; + std::optional second; + std::optional millisecond; + std::optional microsecond; + std::optional nanosecond; + + inline temporal_rs::capi::PartialTime AsFFI() const; + inline static temporal_rs::PartialTime FromFFI(temporal_rs::capi::PartialTime c_struct); }; } // namespace -#endif // temporal_rs_PartialTime_D_HPP +#endif // TEMPORAL_RS_PartialTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialTime.hpp index f7cfc064f..8ac03c53a 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialTime_HPP -#define temporal_rs_PartialTime_HPP +#ifndef TEMPORAL_RS_PartialTime_HPP +#define TEMPORAL_RS_PartialTime_HPP #include "PartialTime.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -24,26 +24,26 @@ namespace capi { inline temporal_rs::capi::PartialTime temporal_rs::PartialTime::AsFFI() const { - return temporal_rs::capi::PartialTime { - /* .hour = */ hour.has_value() ? (diplomat::capi::OptionU8{ { hour.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - /* .minute = */ minute.has_value() ? (diplomat::capi::OptionU8{ { minute.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - /* .second = */ second.has_value() ? (diplomat::capi::OptionU8{ { second.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - /* .millisecond = */ millisecond.has_value() ? (diplomat::capi::OptionU16{ { millisecond.value() }, true }) : (diplomat::capi::OptionU16{ {}, false }), - /* .microsecond = */ microsecond.has_value() ? (diplomat::capi::OptionU16{ { microsecond.value() }, true }) : (diplomat::capi::OptionU16{ {}, false }), - /* .nanosecond = */ nanosecond.has_value() ? (diplomat::capi::OptionU16{ { nanosecond.value() }, true }) : (diplomat::capi::OptionU16{ {}, false }), - }; + return temporal_rs::capi::PartialTime { + /* .hour = */ hour.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { hour.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + /* .minute = */ minute.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { minute.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + /* .second = */ second.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { second.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + /* .millisecond = */ millisecond.has_value() ? (temporal_rs::diplomat::capi::OptionU16{ { millisecond.value() }, true }) : (temporal_rs::diplomat::capi::OptionU16{ {}, false }), + /* .microsecond = */ microsecond.has_value() ? (temporal_rs::diplomat::capi::OptionU16{ { microsecond.value() }, true }) : (temporal_rs::diplomat::capi::OptionU16{ {}, false }), + /* .nanosecond = */ nanosecond.has_value() ? (temporal_rs::diplomat::capi::OptionU16{ { nanosecond.value() }, true }) : (temporal_rs::diplomat::capi::OptionU16{ {}, false }), + }; } inline temporal_rs::PartialTime temporal_rs::PartialTime::FromFFI(temporal_rs::capi::PartialTime c_struct) { - return temporal_rs::PartialTime { - /* .hour = */ c_struct.hour.is_ok ? std::optional(c_struct.hour.ok) : std::nullopt, - /* .minute = */ c_struct.minute.is_ok ? std::optional(c_struct.minute.ok) : std::nullopt, - /* .second = */ c_struct.second.is_ok ? std::optional(c_struct.second.ok) : std::nullopt, - /* .millisecond = */ c_struct.millisecond.is_ok ? std::optional(c_struct.millisecond.ok) : std::nullopt, - /* .microsecond = */ c_struct.microsecond.is_ok ? std::optional(c_struct.microsecond.ok) : std::nullopt, - /* .nanosecond = */ c_struct.nanosecond.is_ok ? std::optional(c_struct.nanosecond.ok) : std::nullopt, - }; + return temporal_rs::PartialTime { + /* .hour = */ c_struct.hour.is_ok ? std::optional(c_struct.hour.ok) : std::nullopt, + /* .minute = */ c_struct.minute.is_ok ? std::optional(c_struct.minute.ok) : std::nullopt, + /* .second = */ c_struct.second.is_ok ? std::optional(c_struct.second.ok) : std::nullopt, + /* .millisecond = */ c_struct.millisecond.is_ok ? std::optional(c_struct.millisecond.ok) : std::nullopt, + /* .microsecond = */ c_struct.microsecond.is_ok ? std::optional(c_struct.microsecond.ok) : std::nullopt, + /* .nanosecond = */ c_struct.nanosecond.is_ok ? std::optional(c_struct.nanosecond.ok) : std::nullopt, + }; } -#endif // temporal_rs_PartialTime_HPP +#endif // TEMPORAL_RS_PartialTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.d.hpp index 3901f6432..0d879eff5 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialZonedDateTime_D_HPP -#define temporal_rs_PartialZonedDateTime_D_HPP +#ifndef TEMPORAL_RS_PartialZonedDateTime_D_HPP +#define TEMPORAL_RS_PartialZonedDateTime_D_HPP #include #include @@ -9,16 +9,16 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PartialDate.d.hpp" #include "PartialTime.d.hpp" #include "TimeZone.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { struct PartialDate; struct PartialTime; struct TimeZone; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -26,7 +26,7 @@ namespace capi { struct PartialZonedDateTime { temporal_rs::capi::PartialDate date; temporal_rs::capi::PartialTime time; - diplomat::capi::OptionStringView offset; + temporal_rs::diplomat::capi::OptionStringView offset; temporal_rs::capi::TimeZone_option timezone; }; @@ -37,14 +37,14 @@ namespace capi { namespace temporal_rs { struct PartialZonedDateTime { - temporal_rs::PartialDate date; - temporal_rs::PartialTime time; - std::optional offset; - std::optional timezone; + temporal_rs::PartialDate date; + temporal_rs::PartialTime time; + std::optional offset; + std::optional timezone; - inline temporal_rs::capi::PartialZonedDateTime AsFFI() const; - inline static temporal_rs::PartialZonedDateTime FromFFI(temporal_rs::capi::PartialZonedDateTime c_struct); + inline temporal_rs::capi::PartialZonedDateTime AsFFI() const; + inline static temporal_rs::PartialZonedDateTime FromFFI(temporal_rs::capi::PartialZonedDateTime c_struct); }; } // namespace -#endif // temporal_rs_PartialZonedDateTime_D_HPP +#endif // TEMPORAL_RS_PartialZonedDateTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.hpp index fb1e9505f..47bf1d218 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PartialZonedDateTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PartialZonedDateTime_HPP -#define temporal_rs_PartialZonedDateTime_HPP +#ifndef TEMPORAL_RS_PartialZonedDateTime_HPP +#define TEMPORAL_RS_PartialZonedDateTime_HPP #include "PartialZonedDateTime.d.hpp" @@ -11,10 +11,10 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PartialDate.hpp" #include "PartialTime.hpp" #include "TimeZone.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -27,22 +27,22 @@ namespace capi { inline temporal_rs::capi::PartialZonedDateTime temporal_rs::PartialZonedDateTime::AsFFI() const { - return temporal_rs::capi::PartialZonedDateTime { - /* .date = */ date.AsFFI(), - /* .time = */ time.AsFFI(), - /* .offset = */ offset.has_value() ? (diplomat::capi::OptionStringView{ { {offset.value().data(), offset.value().size()} }, true }) : (diplomat::capi::OptionStringView{ {}, false }), - /* .timezone = */ timezone.has_value() ? (temporal_rs::capi::TimeZone_option{ { timezone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), - }; + return temporal_rs::capi::PartialZonedDateTime { + /* .date = */ date.AsFFI(), + /* .time = */ time.AsFFI(), + /* .offset = */ offset.has_value() ? (temporal_rs::diplomat::capi::OptionStringView{ { {offset.value().data(), offset.value().size()} }, true }) : (temporal_rs::diplomat::capi::OptionStringView{ {}, false }), + /* .timezone = */ timezone.has_value() ? (temporal_rs::capi::TimeZone_option{ { timezone.value().AsFFI() }, true }) : (temporal_rs::capi::TimeZone_option{ {}, false }), + }; } inline temporal_rs::PartialZonedDateTime temporal_rs::PartialZonedDateTime::FromFFI(temporal_rs::capi::PartialZonedDateTime c_struct) { - return temporal_rs::PartialZonedDateTime { - /* .date = */ temporal_rs::PartialDate::FromFFI(c_struct.date), - /* .time = */ temporal_rs::PartialTime::FromFFI(c_struct.time), - /* .offset = */ c_struct.offset.is_ok ? std::optional(std::string_view(c_struct.offset.ok.data, c_struct.offset.ok.len)) : std::nullopt, - /* .timezone = */ c_struct.timezone.is_ok ? std::optional(temporal_rs::TimeZone::FromFFI(c_struct.timezone.ok)) : std::nullopt, - }; + return temporal_rs::PartialZonedDateTime { + /* .date = */ temporal_rs::PartialDate::FromFFI(c_struct.date), + /* .time = */ temporal_rs::PartialTime::FromFFI(c_struct.time), + /* .offset = */ c_struct.offset.is_ok ? std::optional(std::string_view(c_struct.offset.ok.data, c_struct.offset.ok.len)) : std::nullopt, + /* .timezone = */ c_struct.timezone.is_ok ? std::optional(temporal_rs::TimeZone::FromFFI(c_struct.timezone.ok)) : std::nullopt, + }; } -#endif // temporal_rs_PartialZonedDateTime_HPP +#endif // TEMPORAL_RS_PartialZonedDateTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainDate.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainDate.d.hpp index 13a877ed1..3af8a5d0f 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainDate.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainDate.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainDate_D_HPP -#define temporal_rs_PlainDate_D_HPP +#ifndef TEMPORAL_RS_PlainDate_D_HPP +#define TEMPORAL_RS_PlainDate_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Calendar; } class Calendar; @@ -39,7 +38,8 @@ struct TimeZone; class AnyCalendarKind; class ArithmeticOverflow; class DisplayCalendar; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -52,39 +52,39 @@ namespace temporal_rs { class PlainDate { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new_constrain(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_constrain(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar); - inline static diplomat::result, temporal_rs::TemporalError> try_new(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar); - inline static diplomat::result, temporal_rs::TemporalError> try_new_with_overflow(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_with_overflow(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDate partial, std::optional overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDate partial, std::optional overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDate& parsed); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDate& parsed); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); - inline diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDate partial, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDate partial, std::optional overflow) const; inline std::unique_ptr with_calendar(temporal_rs::AnyCalendarKind calendar) const; - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); inline const temporal_rs::Calendar& calendar() const; inline bool is_valid() const; - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const; inline bool equals(const temporal_rs::PlainDate& other) const; @@ -124,15 +124,15 @@ class PlainDate { inline std::optional era_year() const; - inline diplomat::result, temporal_rs::TemporalError> to_plain_date_time(const temporal_rs::PlainTime* time) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_plain_date_time(const temporal_rs::PlainTime* time) const; - inline diplomat::result, temporal_rs::TemporalError> to_plain_month_day() const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_plain_month_day() const; - inline diplomat::result, temporal_rs::TemporalError> to_plain_year_month() const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_plain_year_month() const; - inline diplomat::result, temporal_rs::TemporalError> to_zoned_date_time(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_zoned_date_time(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time) const; - inline diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const; inline std::string to_ixdtf_string(temporal_rs::DisplayCalendar display_calendar) const; template @@ -140,19 +140,19 @@ class PlainDate { inline std::unique_ptr clone() const; - inline const temporal_rs::capi::PlainDate* AsFFI() const; - inline temporal_rs::capi::PlainDate* AsFFI(); - inline static const temporal_rs::PlainDate* FromFFI(const temporal_rs::capi::PlainDate* ptr); - inline static temporal_rs::PlainDate* FromFFI(temporal_rs::capi::PlainDate* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::PlainDate* AsFFI() const; + inline temporal_rs::capi::PlainDate* AsFFI(); + inline static const temporal_rs::PlainDate* FromFFI(const temporal_rs::capi::PlainDate* ptr); + inline static temporal_rs::PlainDate* FromFFI(temporal_rs::capi::PlainDate* ptr); + inline static void operator delete(void* ptr); private: - PlainDate() = delete; - PlainDate(const temporal_rs::PlainDate&) = delete; - PlainDate(temporal_rs::PlainDate&&) noexcept = delete; - PlainDate operator=(const temporal_rs::PlainDate&) = delete; - PlainDate operator=(temporal_rs::PlainDate&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + PlainDate() = delete; + PlainDate(const temporal_rs::PlainDate&) = delete; + PlainDate(temporal_rs::PlainDate&&) noexcept = delete; + PlainDate operator=(const temporal_rs::PlainDate&) = delete; + PlainDate operator=(temporal_rs::PlainDate&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_PlainDate_D_HPP +#endif // TEMPORAL_RS_PlainDate_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainDate.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainDate.hpp index e7055fd64..3c7b86370 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainDate.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainDate.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainDate_HPP -#define temporal_rs_PlainDate_HPP +#ifndef TEMPORAL_RS_PlainDate_HPP +#define TEMPORAL_RS_PlainDate_HPP #include "PlainDate.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" #include "ArithmeticOverflow.hpp" #include "Calendar.hpp" @@ -28,6 +27,7 @@ #include "TemporalError.hpp" #include "TimeZone.hpp" #include "ZonedDateTime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -61,10 +61,10 @@ namespace capi { temporal_rs::capi::PlainDate* temporal_rs_PlainDate_with_calendar(const temporal_rs::capi::PlainDate* self, temporal_rs::capi::AnyCalendarKind calendar); typedef struct temporal_rs_PlainDate_from_utf8_result {union {temporal_rs::capi::PlainDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainDate_from_utf8_result; - temporal_rs_PlainDate_from_utf8_result temporal_rs_PlainDate_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_PlainDate_from_utf8_result temporal_rs_PlainDate_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_PlainDate_from_utf16_result {union {temporal_rs::capi::PlainDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainDate_from_utf16_result; - temporal_rs_PlainDate_from_utf16_result temporal_rs_PlainDate_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_PlainDate_from_utf16_result temporal_rs_PlainDate_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); const temporal_rs::capi::Calendar* temporal_rs_PlainDate_calendar(const temporal_rs::capi::PlainDate* self); @@ -90,7 +90,7 @@ namespace capi { uint8_t temporal_rs_PlainDate_month(const temporal_rs::capi::PlainDate* self); - void temporal_rs_PlainDate_month_code(const temporal_rs::capi::PlainDate* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainDate_month_code(const temporal_rs::capi::PlainDate* self, temporal_rs::diplomat::capi::DiplomatWrite* write); uint8_t temporal_rs_PlainDate_day(const temporal_rs::capi::PlainDate* self); @@ -114,7 +114,7 @@ namespace capi { bool temporal_rs_PlainDate_in_leap_year(const temporal_rs::capi::PlainDate* self); - void temporal_rs_PlainDate_era(const temporal_rs::capi::PlainDate* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainDate_era(const temporal_rs::capi::PlainDate* self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_PlainDate_era_year_result {union {int32_t ok; }; bool is_ok;} temporal_rs_PlainDate_era_year_result; temporal_rs_PlainDate_era_year_result temporal_rs_PlainDate_era_year(const temporal_rs::capi::PlainDate* self); @@ -134,7 +134,7 @@ namespace capi { typedef struct temporal_rs_PlainDate_to_zoned_date_time_with_provider_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainDate_to_zoned_date_time_with_provider_result; temporal_rs_PlainDate_to_zoned_date_time_with_provider_result temporal_rs_PlainDate_to_zoned_date_time_with_provider(const temporal_rs::capi::PlainDate* self, temporal_rs::capi::TimeZone time_zone, const temporal_rs::capi::PlainTime* time, const temporal_rs::capi::Provider* p); - void temporal_rs_PlainDate_to_ixdtf_string(const temporal_rs::capi::PlainDate* self, temporal_rs::capi::DisplayCalendar display_calendar, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainDate_to_ixdtf_string(const temporal_rs::capi::PlainDate* self, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::PlainDate* temporal_rs_PlainDate_clone(const temporal_rs::capi::PlainDate* self); @@ -144,292 +144,292 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::try_new_constrain(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_try_new_constrain(year, - month, - day, - calendar.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::try_new_constrain(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_try_new_constrain(year, + month, + day, + calendar.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::try_new(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_try_new(year, - month, - day, - calendar.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::try_new(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_try_new(year, + month, + day, + calendar.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::try_new_with_overflow(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_try_new_with_overflow(year, - month, - day, - calendar.AsFFI(), - overflow.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::try_new_with_overflow(int32_t year, uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_try_new_with_overflow(year, + month, + day, + calendar.AsFFI(), + overflow.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_partial(temporal_rs::PartialDate partial, std::optional overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_from_partial(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_partial(temporal_rs::PartialDate partial, std::optional overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_from_partial(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_parsed(const temporal_rs::ParsedDate& parsed) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_from_parsed(parsed.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_parsed(const temporal_rs::ParsedDate& parsed) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_from_parsed(parsed.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_from_epoch_milliseconds(ms, - tz.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_from_epoch_milliseconds(ms, + tz.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_from_epoch_milliseconds_with_provider(ms, - tz.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_from_epoch_milliseconds_with_provider(ms, + tz.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::with(temporal_rs::PartialDate partial, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_with(this->AsFFI(), - partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::with(temporal_rs::PartialDate partial, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_with(this->AsFFI(), + partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::PlainDate::with_calendar(temporal_rs::AnyCalendarKind calendar) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_with_calendar(this->AsFFI(), - calendar.AsFFI()); - return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainDate_with_calendar(this->AsFFI(), + calendar.AsFFI()); + return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainDate_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline const temporal_rs::Calendar& temporal_rs::PlainDate::calendar() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_calendar(this->AsFFI()); - return *temporal_rs::Calendar::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_PlainDate_calendar(this->AsFFI()); + return *temporal_rs::Calendar::FromFFI(result); } inline bool temporal_rs::PlainDate::is_valid() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_is_valid(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_is_valid(this->AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::add(const temporal_rs::Duration& duration, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_add(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::add(const temporal_rs::Duration& duration, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_add(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::subtract(const temporal_rs::Duration& duration, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_subtract(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::subtract(const temporal_rs::Duration& duration, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_subtract(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::until(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_until(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::until(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_until(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::since(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_since(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::since(const temporal_rs::PlainDate& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_since(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::PlainDate::equals(const temporal_rs::PlainDate& other) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_equals(this->AsFFI(), + other.AsFFI()); + return result; } inline int8_t temporal_rs::PlainDate::compare(const temporal_rs::PlainDate& one, const temporal_rs::PlainDate& two) { - auto result = temporal_rs::capi::temporal_rs_PlainDate_compare(one.AsFFI(), - two.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_compare(one.AsFFI(), + two.AsFFI()); + return result; } inline int32_t temporal_rs::PlainDate::year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_year(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainDate::month() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_month(this->AsFFI()); + return result; } inline std::string temporal_rs::PlainDate::month_code() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainDate_month_code(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainDate_month_code(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainDate::month_code_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainDate_month_code(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainDate_month_code(this->AsFFI(), + &write); } inline uint8_t temporal_rs::PlainDate::day() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_day(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_day(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDate::day_of_week() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_day_of_week(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_day_of_week(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDate::day_of_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_day_of_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_day_of_year(this->AsFFI()); + return result; } inline std::optional temporal_rs::PlainDate::week_of_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_week_of_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainDate_week_of_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline std::optional temporal_rs::PlainDate::year_of_week() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_year_of_week(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainDate_year_of_week(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline uint16_t temporal_rs::PlainDate::days_in_week() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_days_in_week(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_days_in_week(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDate::days_in_month() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_days_in_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_days_in_month(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDate::days_in_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_days_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_days_in_year(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDate::months_in_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_months_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_months_in_year(this->AsFFI()); + return result; } inline bool temporal_rs::PlainDate::in_leap_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_in_leap_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDate_in_leap_year(this->AsFFI()); + return result; } inline std::string temporal_rs::PlainDate::era() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainDate_era(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainDate_era(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainDate::era_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainDate_era(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainDate_era(this->AsFFI(), + &write); } inline std::optional temporal_rs::PlainDate::era_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_era_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainDate_era_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_plain_date_time(const temporal_rs::PlainTime* time) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_to_plain_date_time(this->AsFFI(), - time ? time->AsFFI() : nullptr); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_plain_date_time(const temporal_rs::PlainTime* time) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_to_plain_date_time(this->AsFFI(), + time ? time->AsFFI() : nullptr); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_plain_month_day() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_to_plain_month_day(this->AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_plain_month_day() const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_to_plain_month_day(this->AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_plain_year_month() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_to_plain_year_month(this->AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_plain_year_month() const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_to_plain_year_month(this->AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_zoned_date_time(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_to_zoned_date_time(this->AsFFI(), - time_zone.AsFFI(), - time ? time->AsFFI() : nullptr); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_zoned_date_time(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_to_zoned_date_time(this->AsFFI(), + time_zone.AsFFI(), + time ? time->AsFFI() : nullptr); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_to_zoned_date_time_with_provider(this->AsFFI(), - time_zone.AsFFI(), - time ? time->AsFFI() : nullptr, - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDate::to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_PlainDate_to_zoned_date_time_with_provider(this->AsFFI(), + time_zone.AsFFI(), + time ? time->AsFFI() : nullptr, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::string temporal_rs::PlainDate::to_ixdtf_string(temporal_rs::DisplayCalendar display_calendar) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainDate_to_ixdtf_string(this->AsFFI(), - display_calendar.AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainDate_to_ixdtf_string(this->AsFFI(), + display_calendar.AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainDate::to_ixdtf_string_write(temporal_rs::DisplayCalendar display_calendar, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainDate_to_ixdtf_string(this->AsFFI(), - display_calendar.AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainDate_to_ixdtf_string(this->AsFFI(), + display_calendar.AsFFI(), + &write); } inline std::unique_ptr temporal_rs::PlainDate::clone() const { - auto result = temporal_rs::capi::temporal_rs_PlainDate_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainDate_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); } inline const temporal_rs::capi::PlainDate* temporal_rs::PlainDate::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::PlainDate* temporal_rs::PlainDate::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::PlainDate* temporal_rs::PlainDate::FromFFI(const temporal_rs::capi::PlainDate* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::PlainDate* temporal_rs::PlainDate::FromFFI(temporal_rs::capi::PlainDate* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::PlainDate::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_PlainDate_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_PlainDate_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_PlainDate_HPP +#endif // TEMPORAL_RS_PlainDate_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.d.hpp index c5dcfc32b..8add044fa 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainDateTime_D_HPP -#define temporal_rs_PlainDateTime_D_HPP +#ifndef TEMPORAL_RS_PlainDateTime_D_HPP +#define TEMPORAL_RS_PlainDateTime_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Calendar; } class Calendar; @@ -38,7 +37,8 @@ class AnyCalendarKind; class ArithmeticOverflow; class Disambiguation; class DisplayCalendar; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -51,27 +51,27 @@ namespace temporal_rs { class PlainDateTime { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new_constrain(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_constrain(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar); - inline static diplomat::result, temporal_rs::TemporalError> try_new(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar); - inline static diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDateTime partial, std::optional overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDateTime partial, std::optional overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDateTime& parsed); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDateTime& parsed); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); - inline diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDateTime partial, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDateTime partial, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> with_time(const temporal_rs::PlainTime* time) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with_time(const temporal_rs::PlainTime* time) const; inline std::unique_ptr with_calendar(temporal_rs::AnyCalendarKind calendar) const; - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); inline uint8_t hour() const; @@ -121,47 +121,47 @@ class PlainDateTime { inline std::optional era_year() const; - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const; inline bool equals(const temporal_rs::PlainDateTime& other) const; inline static int8_t compare(const temporal_rs::PlainDateTime& one, const temporal_rs::PlainDateTime& two); - inline diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; inline std::unique_ptr to_plain_date() const; inline std::unique_ptr to_plain_time() const; - inline diplomat::result, temporal_rs::TemporalError> to_zoned_date_time(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_zoned_date_time(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation) const; - inline diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation, const temporal_rs::Provider& p) const; - inline diplomat::result to_ixdtf_string(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar) const; + inline temporal_rs::diplomat::result to_ixdtf_string(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar) const; template - inline diplomat::result to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar, W& writeable_output) const; + inline temporal_rs::diplomat::result to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar, W& writeable_output) const; inline std::unique_ptr clone() const; - inline const temporal_rs::capi::PlainDateTime* AsFFI() const; - inline temporal_rs::capi::PlainDateTime* AsFFI(); - inline static const temporal_rs::PlainDateTime* FromFFI(const temporal_rs::capi::PlainDateTime* ptr); - inline static temporal_rs::PlainDateTime* FromFFI(temporal_rs::capi::PlainDateTime* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::PlainDateTime* AsFFI() const; + inline temporal_rs::capi::PlainDateTime* AsFFI(); + inline static const temporal_rs::PlainDateTime* FromFFI(const temporal_rs::capi::PlainDateTime* ptr); + inline static temporal_rs::PlainDateTime* FromFFI(temporal_rs::capi::PlainDateTime* ptr); + inline static void operator delete(void* ptr); private: - PlainDateTime() = delete; - PlainDateTime(const temporal_rs::PlainDateTime&) = delete; - PlainDateTime(temporal_rs::PlainDateTime&&) noexcept = delete; - PlainDateTime operator=(const temporal_rs::PlainDateTime&) = delete; - PlainDateTime operator=(temporal_rs::PlainDateTime&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + PlainDateTime() = delete; + PlainDateTime(const temporal_rs::PlainDateTime&) = delete; + PlainDateTime(temporal_rs::PlainDateTime&&) noexcept = delete; + PlainDateTime operator=(const temporal_rs::PlainDateTime&) = delete; + PlainDateTime operator=(temporal_rs::PlainDateTime&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_PlainDateTime_D_HPP +#endif // TEMPORAL_RS_PlainDateTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.hpp index 257d2eabe..3eaf965eb 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainDateTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainDateTime_HPP -#define temporal_rs_PlainDateTime_HPP +#ifndef TEMPORAL_RS_PlainDateTime_HPP +#define TEMPORAL_RS_PlainDateTime_HPP #include "PlainDateTime.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" #include "ArithmeticOverflow.hpp" #include "Calendar.hpp" @@ -29,6 +28,7 @@ #include "TimeZone.hpp" #include "ToStringRoundingOptions.hpp" #include "ZonedDateTime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -62,10 +62,10 @@ namespace capi { temporal_rs::capi::PlainDateTime* temporal_rs_PlainDateTime_with_calendar(const temporal_rs::capi::PlainDateTime* self, temporal_rs::capi::AnyCalendarKind calendar); typedef struct temporal_rs_PlainDateTime_from_utf8_result {union {temporal_rs::capi::PlainDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainDateTime_from_utf8_result; - temporal_rs_PlainDateTime_from_utf8_result temporal_rs_PlainDateTime_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_PlainDateTime_from_utf8_result temporal_rs_PlainDateTime_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_PlainDateTime_from_utf16_result {union {temporal_rs::capi::PlainDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainDateTime_from_utf16_result; - temporal_rs_PlainDateTime_from_utf16_result temporal_rs_PlainDateTime_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_PlainDateTime_from_utf16_result temporal_rs_PlainDateTime_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); uint8_t temporal_rs_PlainDateTime_hour(const temporal_rs::capi::PlainDateTime* self); @@ -85,7 +85,7 @@ namespace capi { uint8_t temporal_rs_PlainDateTime_month(const temporal_rs::capi::PlainDateTime* self); - void temporal_rs_PlainDateTime_month_code(const temporal_rs::capi::PlainDateTime* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainDateTime_month_code(const temporal_rs::capi::PlainDateTime* self, temporal_rs::diplomat::capi::DiplomatWrite* write); uint8_t temporal_rs_PlainDateTime_day(const temporal_rs::capi::PlainDateTime* self); @@ -109,7 +109,7 @@ namespace capi { bool temporal_rs_PlainDateTime_in_leap_year(const temporal_rs::capi::PlainDateTime* self); - void temporal_rs_PlainDateTime_era(const temporal_rs::capi::PlainDateTime* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainDateTime_era(const temporal_rs::capi::PlainDateTime* self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_PlainDateTime_era_year_result {union {int32_t ok; }; bool is_ok;} temporal_rs_PlainDateTime_era_year_result; temporal_rs_PlainDateTime_era_year_result temporal_rs_PlainDateTime_era_year(const temporal_rs::capi::PlainDateTime* self); @@ -144,7 +144,7 @@ namespace capi { temporal_rs_PlainDateTime_to_zoned_date_time_with_provider_result temporal_rs_PlainDateTime_to_zoned_date_time_with_provider(const temporal_rs::capi::PlainDateTime* self, temporal_rs::capi::TimeZone time_zone, temporal_rs::capi::Disambiguation disambiguation, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_PlainDateTime_to_ixdtf_string_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainDateTime_to_ixdtf_string_result; - temporal_rs_PlainDateTime_to_ixdtf_string_result temporal_rs_PlainDateTime_to_ixdtf_string(const temporal_rs::capi::PlainDateTime* self, temporal_rs::capi::ToStringRoundingOptions options, temporal_rs::capi::DisplayCalendar display_calendar, diplomat::capi::DiplomatWrite* write); + temporal_rs_PlainDateTime_to_ixdtf_string_result temporal_rs_PlainDateTime_to_ixdtf_string(const temporal_rs::capi::PlainDateTime* self, temporal_rs::capi::ToStringRoundingOptions options, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::PlainDateTime* temporal_rs_PlainDateTime_clone(const temporal_rs::capi::PlainDateTime* self); @@ -154,329 +154,329 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::try_new_constrain(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_try_new_constrain(year, - month, - day, - hour, - minute, - second, - millisecond, - microsecond, - nanosecond, - calendar.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::try_new_constrain(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_try_new_constrain(year, + month, + day, + hour, + minute, + second, + millisecond, + microsecond, + nanosecond, + calendar.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::try_new(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_try_new(year, - month, - day, - hour, - minute, - second, - millisecond, - microsecond, - nanosecond, - calendar.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::try_new(int32_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond, temporal_rs::AnyCalendarKind calendar) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_try_new(year, + month, + day, + hour, + minute, + second, + millisecond, + microsecond, + nanosecond, + calendar.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_partial(temporal_rs::PartialDateTime partial, std::optional overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_partial(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_partial(temporal_rs::PartialDateTime partial, std::optional overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_partial(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_parsed(const temporal_rs::ParsedDateTime& parsed) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_parsed(parsed.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_parsed(const temporal_rs::ParsedDateTime& parsed) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_parsed(parsed.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_epoch_milliseconds(ms, - tz.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_epoch_milliseconds(ms, + tz.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_epoch_milliseconds_with_provider(ms, - tz.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_epoch_milliseconds_with_provider(ms, + tz.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::with(temporal_rs::PartialDateTime partial, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_with(this->AsFFI(), - partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::with(temporal_rs::PartialDateTime partial, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_with(this->AsFFI(), + partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::with_time(const temporal_rs::PlainTime* time) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_with_time(this->AsFFI(), - time ? time->AsFFI() : nullptr); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::with_time(const temporal_rs::PlainTime* time) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_with_time(this->AsFFI(), + time ? time->AsFFI() : nullptr); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::PlainDateTime::with_calendar(temporal_rs::AnyCalendarKind calendar) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_with_calendar(this->AsFFI(), - calendar.AsFFI()); - return std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_with_calendar(this->AsFFI(), + calendar.AsFFI()); + return std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline uint8_t temporal_rs::PlainDateTime::hour() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_hour(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_hour(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainDateTime::minute() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_minute(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_minute(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainDateTime::second() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_second(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_second(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::millisecond() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_millisecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_millisecond(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::microsecond() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_microsecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_microsecond(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::nanosecond() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_nanosecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_nanosecond(this->AsFFI()); + return result; } inline const temporal_rs::Calendar& temporal_rs::PlainDateTime::calendar() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_calendar(this->AsFFI()); - return *temporal_rs::Calendar::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_calendar(this->AsFFI()); + return *temporal_rs::Calendar::FromFFI(result); } inline int32_t temporal_rs::PlainDateTime::year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_year(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainDateTime::month() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_month(this->AsFFI()); + return result; } inline std::string temporal_rs::PlainDateTime::month_code() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainDateTime_month_code(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainDateTime_month_code(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainDateTime::month_code_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainDateTime_month_code(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainDateTime_month_code(this->AsFFI(), + &write); } inline uint8_t temporal_rs::PlainDateTime::day() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_day(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_day(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::day_of_week() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_day_of_week(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_day_of_week(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::day_of_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_day_of_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_day_of_year(this->AsFFI()); + return result; } inline std::optional temporal_rs::PlainDateTime::week_of_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_week_of_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_week_of_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline std::optional temporal_rs::PlainDateTime::year_of_week() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_year_of_week(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_year_of_week(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline uint16_t temporal_rs::PlainDateTime::days_in_week() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_days_in_week(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_days_in_week(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::days_in_month() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_days_in_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_days_in_month(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::days_in_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_days_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_days_in_year(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainDateTime::months_in_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_months_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_months_in_year(this->AsFFI()); + return result; } inline bool temporal_rs::PlainDateTime::in_leap_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_in_leap_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_in_leap_year(this->AsFFI()); + return result; } inline std::string temporal_rs::PlainDateTime::era() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainDateTime_era(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainDateTime_era(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainDateTime::era_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainDateTime_era(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainDateTime_era(this->AsFFI(), + &write); } inline std::optional temporal_rs::PlainDateTime::era_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_era_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_era_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::add(const temporal_rs::Duration& duration, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_add(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::add(const temporal_rs::Duration& duration, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_add(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::subtract(const temporal_rs::Duration& duration, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_subtract(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::subtract(const temporal_rs::Duration& duration, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_subtract(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::until(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_until(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::until(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_until(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::since(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_since(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::since(const temporal_rs::PlainDateTime& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_since(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::PlainDateTime::equals(const temporal_rs::PlainDateTime& other) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_equals(this->AsFFI(), + other.AsFFI()); + return result; } inline int8_t temporal_rs::PlainDateTime::compare(const temporal_rs::PlainDateTime& one, const temporal_rs::PlainDateTime& two) { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_compare(one.AsFFI(), - two.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_compare(one.AsFFI(), + two.AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::round(temporal_rs::RoundingOptions options) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_round(this->AsFFI(), - options.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::round(temporal_rs::RoundingOptions options) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_round(this->AsFFI(), + options.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::PlainDateTime::to_plain_date() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_plain_date(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_plain_date(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); } inline std::unique_ptr temporal_rs::PlainDateTime::to_plain_time() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_plain_time(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_plain_time(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainTime::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::to_zoned_date_time(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_zoned_date_time(this->AsFFI(), - time_zone.AsFFI(), - disambiguation.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::to_zoned_date_time(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_zoned_date_time(this->AsFFI(), + time_zone.AsFFI(), + disambiguation.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_zoned_date_time_with_provider(this->AsFFI(), - time_zone.AsFFI(), - disambiguation.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainDateTime::to_zoned_date_time_with_provider(temporal_rs::TimeZone time_zone, temporal_rs::Disambiguation disambiguation, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_zoned_date_time_with_provider(this->AsFFI(), + time_zone.AsFFI(), + disambiguation.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::PlainDateTime::to_ixdtf_string(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_ixdtf_string(this->AsFFI(), - options.AsFFI(), - display_calendar.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainDateTime::to_ixdtf_string(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_ixdtf_string(this->AsFFI(), + options.AsFFI(), + display_calendar.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::PlainDateTime::to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_ixdtf_string(this->AsFFI(), - options.AsFFI(), - display_calendar.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainDateTime::to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, temporal_rs::DisplayCalendar display_calendar, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_to_ixdtf_string(this->AsFFI(), + options.AsFFI(), + display_calendar.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::PlainDateTime::clone() const { - auto result = temporal_rs::capi::temporal_rs_PlainDateTime_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainDateTime_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result)); } inline const temporal_rs::capi::PlainDateTime* temporal_rs::PlainDateTime::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::PlainDateTime* temporal_rs::PlainDateTime::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::PlainDateTime* temporal_rs::PlainDateTime::FromFFI(const temporal_rs::capi::PlainDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::PlainDateTime* temporal_rs::PlainDateTime::FromFFI(temporal_rs::capi::PlainDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::PlainDateTime::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_PlainDateTime_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_PlainDateTime_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_PlainDateTime_HPP +#endif // TEMPORAL_RS_PlainDateTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.d.hpp index c18c41c61..5638252ac 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainMonthDay_D_HPP -#define temporal_rs_PlainMonthDay_D_HPP +#ifndef TEMPORAL_RS_PlainMonthDay_D_HPP +#define TEMPORAL_RS_PlainMonthDay_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Calendar; } class Calendar; @@ -28,7 +27,8 @@ struct TimeZone; class AnyCalendarKind; class ArithmeticOverflow; class DisplayCalendar; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -41,19 +41,19 @@ namespace temporal_rs { class PlainMonthDay { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new_with_overflow(uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow, std::optional ref_year); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_with_overflow(uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow, std::optional ref_year); - inline static diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDate partial, std::optional overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDate partial, std::optional overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDate& parsed); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDate& parsed); - inline diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDate partial, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDate partial, std::optional overflow) const; inline bool equals(const temporal_rs::PlainMonthDay& other) const; - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); inline uint8_t day() const; @@ -63,11 +63,11 @@ class PlainMonthDay { template inline void month_code_write(W& writeable_output) const; - inline diplomat::result, temporal_rs::TemporalError> to_plain_date(std::optional year) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_plain_date(std::optional year) const; - inline diplomat::result epoch_ms_for(temporal_rs::TimeZone time_zone) const; + inline temporal_rs::diplomat::result epoch_ms_for(temporal_rs::TimeZone time_zone) const; - inline diplomat::result epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const; inline std::string to_ixdtf_string(temporal_rs::DisplayCalendar display_calendar) const; template @@ -75,19 +75,19 @@ class PlainMonthDay { inline std::unique_ptr clone() const; - inline const temporal_rs::capi::PlainMonthDay* AsFFI() const; - inline temporal_rs::capi::PlainMonthDay* AsFFI(); - inline static const temporal_rs::PlainMonthDay* FromFFI(const temporal_rs::capi::PlainMonthDay* ptr); - inline static temporal_rs::PlainMonthDay* FromFFI(temporal_rs::capi::PlainMonthDay* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::PlainMonthDay* AsFFI() const; + inline temporal_rs::capi::PlainMonthDay* AsFFI(); + inline static const temporal_rs::PlainMonthDay* FromFFI(const temporal_rs::capi::PlainMonthDay* ptr); + inline static temporal_rs::PlainMonthDay* FromFFI(temporal_rs::capi::PlainMonthDay* ptr); + inline static void operator delete(void* ptr); private: - PlainMonthDay() = delete; - PlainMonthDay(const temporal_rs::PlainMonthDay&) = delete; - PlainMonthDay(temporal_rs::PlainMonthDay&&) noexcept = delete; - PlainMonthDay operator=(const temporal_rs::PlainMonthDay&) = delete; - PlainMonthDay operator=(temporal_rs::PlainMonthDay&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + PlainMonthDay() = delete; + PlainMonthDay(const temporal_rs::PlainMonthDay&) = delete; + PlainMonthDay(temporal_rs::PlainMonthDay&&) noexcept = delete; + PlainMonthDay operator=(const temporal_rs::PlainMonthDay&) = delete; + PlainMonthDay operator=(temporal_rs::PlainMonthDay&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_PlainMonthDay_D_HPP +#endif // TEMPORAL_RS_PlainMonthDay_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.hpp index 746aa7621..01e409f4c 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainMonthDay.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainMonthDay_HPP -#define temporal_rs_PlainMonthDay_HPP +#ifndef TEMPORAL_RS_PlainMonthDay_HPP +#define TEMPORAL_RS_PlainMonthDay_HPP #include "PlainMonthDay.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" #include "ArithmeticOverflow.hpp" #include "Calendar.hpp" @@ -22,6 +21,7 @@ #include "Provider.hpp" #include "TemporalError.hpp" #include "TimeZone.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -29,7 +29,7 @@ namespace capi { extern "C" { typedef struct temporal_rs_PlainMonthDay_try_new_with_overflow_result {union {temporal_rs::capi::PlainMonthDay* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainMonthDay_try_new_with_overflow_result; - temporal_rs_PlainMonthDay_try_new_with_overflow_result temporal_rs_PlainMonthDay_try_new_with_overflow(uint8_t month, uint8_t day, temporal_rs::capi::AnyCalendarKind calendar, temporal_rs::capi::ArithmeticOverflow overflow, diplomat::capi::OptionI32 ref_year); + temporal_rs_PlainMonthDay_try_new_with_overflow_result temporal_rs_PlainMonthDay_try_new_with_overflow(uint8_t month, uint8_t day, temporal_rs::capi::AnyCalendarKind calendar, temporal_rs::capi::ArithmeticOverflow overflow, temporal_rs::diplomat::capi::OptionI32 ref_year); typedef struct temporal_rs_PlainMonthDay_from_partial_result {union {temporal_rs::capi::PlainMonthDay* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainMonthDay_from_partial_result; temporal_rs_PlainMonthDay_from_partial_result temporal_rs_PlainMonthDay_from_partial(temporal_rs::capi::PartialDate partial, temporal_rs::capi::ArithmeticOverflow_option overflow); @@ -43,16 +43,16 @@ namespace capi { bool temporal_rs_PlainMonthDay_equals(const temporal_rs::capi::PlainMonthDay* self, const temporal_rs::capi::PlainMonthDay* other); typedef struct temporal_rs_PlainMonthDay_from_utf8_result {union {temporal_rs::capi::PlainMonthDay* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainMonthDay_from_utf8_result; - temporal_rs_PlainMonthDay_from_utf8_result temporal_rs_PlainMonthDay_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_PlainMonthDay_from_utf8_result temporal_rs_PlainMonthDay_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_PlainMonthDay_from_utf16_result {union {temporal_rs::capi::PlainMonthDay* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainMonthDay_from_utf16_result; - temporal_rs_PlainMonthDay_from_utf16_result temporal_rs_PlainMonthDay_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_PlainMonthDay_from_utf16_result temporal_rs_PlainMonthDay_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); uint8_t temporal_rs_PlainMonthDay_day(const temporal_rs::capi::PlainMonthDay* self); const temporal_rs::capi::Calendar* temporal_rs_PlainMonthDay_calendar(const temporal_rs::capi::PlainMonthDay* self); - void temporal_rs_PlainMonthDay_month_code(const temporal_rs::capi::PlainMonthDay* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainMonthDay_month_code(const temporal_rs::capi::PlainMonthDay* self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_PlainMonthDay_to_plain_date_result {union {temporal_rs::capi::PlainDate* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainMonthDay_to_plain_date_result; temporal_rs_PlainMonthDay_to_plain_date_result temporal_rs_PlainMonthDay_to_plain_date(const temporal_rs::capi::PlainMonthDay* self, temporal_rs::capi::PartialDate_option year); @@ -63,7 +63,7 @@ namespace capi { typedef struct temporal_rs_PlainMonthDay_epoch_ms_for_with_provider_result {union {int64_t ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainMonthDay_epoch_ms_for_with_provider_result; temporal_rs_PlainMonthDay_epoch_ms_for_with_provider_result temporal_rs_PlainMonthDay_epoch_ms_for_with_provider(const temporal_rs::capi::PlainMonthDay* self, temporal_rs::capi::TimeZone time_zone, const temporal_rs::capi::Provider* p); - void temporal_rs_PlainMonthDay_to_ixdtf_string(const temporal_rs::capi::PlainMonthDay* self, temporal_rs::capi::DisplayCalendar display_calendar, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainMonthDay_to_ixdtf_string(const temporal_rs::capi::PlainMonthDay* self, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::PlainMonthDay* temporal_rs_PlainMonthDay_clone(const temporal_rs::capi::PlainMonthDay* self); @@ -73,132 +73,132 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::try_new_with_overflow(uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow, std::optional ref_year) { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_try_new_with_overflow(month, - day, - calendar.AsFFI(), - overflow.AsFFI(), - ref_year.has_value() ? (diplomat::capi::OptionI32{ { ref_year.value() }, true }) : (diplomat::capi::OptionI32{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::try_new_with_overflow(uint8_t month, uint8_t day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow, std::optional ref_year) { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_try_new_with_overflow(month, + day, + calendar.AsFFI(), + overflow.AsFFI(), + ref_year.has_value() ? (temporal_rs::diplomat::capi::OptionI32{ { ref_year.value() }, true }) : (temporal_rs::diplomat::capi::OptionI32{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_partial(temporal_rs::PartialDate partial, std::optional overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_partial(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_partial(temporal_rs::PartialDate partial, std::optional overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_partial(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_parsed(const temporal_rs::ParsedDate& parsed) { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_parsed(parsed.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_parsed(const temporal_rs::ParsedDate& parsed) { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_parsed(parsed.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::with(temporal_rs::PartialDate partial, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_with(this->AsFFI(), - partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::with(temporal_rs::PartialDate partial, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_with(this->AsFFI(), + partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::PlainMonthDay::equals(const temporal_rs::PlainMonthDay& other) const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_equals(this->AsFFI(), + other.AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline uint8_t temporal_rs::PlainMonthDay::day() const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_day(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_day(this->AsFFI()); + return result; } inline const temporal_rs::Calendar& temporal_rs::PlainMonthDay::calendar() const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_calendar(this->AsFFI()); - return *temporal_rs::Calendar::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_calendar(this->AsFFI()); + return *temporal_rs::Calendar::FromFFI(result); } inline std::string temporal_rs::PlainMonthDay::month_code() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainMonthDay_month_code(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainMonthDay_month_code(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainMonthDay::month_code_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainMonthDay_month_code(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainMonthDay_month_code(this->AsFFI(), + &write); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::to_plain_date(std::optional year) const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_to_plain_date(this->AsFFI(), - year.has_value() ? (temporal_rs::capi::PartialDate_option{ { year.value().AsFFI() }, true }) : (temporal_rs::capi::PartialDate_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainMonthDay::to_plain_date(std::optional year) const { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_to_plain_date(this->AsFFI(), + year.has_value() ? (temporal_rs::capi::PartialDate_option{ { year.value().AsFFI() }, true }) : (temporal_rs::capi::PartialDate_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::PlainMonthDay::epoch_ms_for(temporal_rs::TimeZone time_zone) const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_epoch_ms_for(this->AsFFI(), - time_zone.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainMonthDay::epoch_ms_for(temporal_rs::TimeZone time_zone) const { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_epoch_ms_for(this->AsFFI(), + time_zone.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::PlainMonthDay::epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_epoch_ms_for_with_provider(this->AsFFI(), - time_zone.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainMonthDay::epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_epoch_ms_for_with_provider(this->AsFFI(), + time_zone.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::string temporal_rs::PlainMonthDay::to_ixdtf_string(temporal_rs::DisplayCalendar display_calendar) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainMonthDay_to_ixdtf_string(this->AsFFI(), - display_calendar.AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainMonthDay_to_ixdtf_string(this->AsFFI(), + display_calendar.AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainMonthDay::to_ixdtf_string_write(temporal_rs::DisplayCalendar display_calendar, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainMonthDay_to_ixdtf_string(this->AsFFI(), - display_calendar.AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainMonthDay_to_ixdtf_string(this->AsFFI(), + display_calendar.AsFFI(), + &write); } inline std::unique_ptr temporal_rs::PlainMonthDay::clone() const { - auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainMonthDay_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainMonthDay::FromFFI(result)); } inline const temporal_rs::capi::PlainMonthDay* temporal_rs::PlainMonthDay::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::PlainMonthDay* temporal_rs::PlainMonthDay::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::PlainMonthDay* temporal_rs::PlainMonthDay::FromFFI(const temporal_rs::capi::PlainMonthDay* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::PlainMonthDay* temporal_rs::PlainMonthDay::FromFFI(temporal_rs::capi::PlainMonthDay* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::PlainMonthDay::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_PlainMonthDay_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_PlainMonthDay_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_PlainMonthDay_HPP +#endif // TEMPORAL_RS_PlainMonthDay_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainTime.d.hpp index 0ff2d96b3..349f1f434 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainTime_D_HPP -#define temporal_rs_PlainTime_D_HPP +#ifndef TEMPORAL_RS_PlainTime_D_HPP +#define TEMPORAL_RS_PlainTime_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Duration; } class Duration; @@ -25,7 +24,8 @@ struct TemporalError; struct TimeZone; struct ToStringRoundingOptions; class ArithmeticOverflow; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -38,21 +38,21 @@ namespace temporal_rs { class PlainTime { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new_constrain(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_constrain(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond); - inline static diplomat::result, temporal_rs::TemporalError> try_new(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond); - inline static diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialTime partial, std::optional overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialTime partial, std::optional overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); - inline diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialTime partial, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialTime partial, std::optional overflow) const; - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); inline uint8_t hour() const; @@ -66,39 +66,39 @@ class PlainTime { inline uint16_t nanosecond() const; - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration) const; - inline diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const; inline bool equals(const temporal_rs::PlainTime& other) const; inline static int8_t compare(const temporal_rs::PlainTime& one, const temporal_rs::PlainTime& two); - inline diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; - inline diplomat::result to_ixdtf_string(temporal_rs::ToStringRoundingOptions options) const; + inline temporal_rs::diplomat::result to_ixdtf_string(temporal_rs::ToStringRoundingOptions options) const; template - inline diplomat::result to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; + inline temporal_rs::diplomat::result to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; inline std::unique_ptr clone() const; - inline const temporal_rs::capi::PlainTime* AsFFI() const; - inline temporal_rs::capi::PlainTime* AsFFI(); - inline static const temporal_rs::PlainTime* FromFFI(const temporal_rs::capi::PlainTime* ptr); - inline static temporal_rs::PlainTime* FromFFI(temporal_rs::capi::PlainTime* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::PlainTime* AsFFI() const; + inline temporal_rs::capi::PlainTime* AsFFI(); + inline static const temporal_rs::PlainTime* FromFFI(const temporal_rs::capi::PlainTime* ptr); + inline static temporal_rs::PlainTime* FromFFI(temporal_rs::capi::PlainTime* ptr); + inline static void operator delete(void* ptr); private: - PlainTime() = delete; - PlainTime(const temporal_rs::PlainTime&) = delete; - PlainTime(temporal_rs::PlainTime&&) noexcept = delete; - PlainTime operator=(const temporal_rs::PlainTime&) = delete; - PlainTime operator=(temporal_rs::PlainTime&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + PlainTime() = delete; + PlainTime(const temporal_rs::PlainTime&) = delete; + PlainTime(temporal_rs::PlainTime&&) noexcept = delete; + PlainTime operator=(const temporal_rs::PlainTime&) = delete; + PlainTime operator=(temporal_rs::PlainTime&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_PlainTime_D_HPP +#endif // TEMPORAL_RS_PlainTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainTime.hpp index 9aaee341e..044117965 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainTime_HPP -#define temporal_rs_PlainTime_HPP +#ifndef TEMPORAL_RS_PlainTime_HPP +#define TEMPORAL_RS_PlainTime_HPP #include "PlainTime.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "ArithmeticOverflow.hpp" #include "DifferenceSettings.hpp" #include "Duration.hpp" @@ -21,6 +20,7 @@ #include "TemporalError.hpp" #include "TimeZone.hpp" #include "ToStringRoundingOptions.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -46,10 +46,10 @@ namespace capi { temporal_rs_PlainTime_with_result temporal_rs_PlainTime_with(const temporal_rs::capi::PlainTime* self, temporal_rs::capi::PartialTime partial, temporal_rs::capi::ArithmeticOverflow_option overflow); typedef struct temporal_rs_PlainTime_from_utf8_result {union {temporal_rs::capi::PlainTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainTime_from_utf8_result; - temporal_rs_PlainTime_from_utf8_result temporal_rs_PlainTime_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_PlainTime_from_utf8_result temporal_rs_PlainTime_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_PlainTime_from_utf16_result {union {temporal_rs::capi::PlainTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainTime_from_utf16_result; - temporal_rs_PlainTime_from_utf16_result temporal_rs_PlainTime_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_PlainTime_from_utf16_result temporal_rs_PlainTime_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); uint8_t temporal_rs_PlainTime_hour(const temporal_rs::capi::PlainTime* self); @@ -83,7 +83,7 @@ namespace capi { temporal_rs_PlainTime_round_result temporal_rs_PlainTime_round(const temporal_rs::capi::PlainTime* self, temporal_rs::capi::RoundingOptions options); typedef struct temporal_rs_PlainTime_to_ixdtf_string_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainTime_to_ixdtf_string_result; - temporal_rs_PlainTime_to_ixdtf_string_result temporal_rs_PlainTime_to_ixdtf_string(const temporal_rs::capi::PlainTime* self, temporal_rs::capi::ToStringRoundingOptions options, diplomat::capi::DiplomatWrite* write); + temporal_rs_PlainTime_to_ixdtf_string_result temporal_rs_PlainTime_to_ixdtf_string(const temporal_rs::capi::PlainTime* self, temporal_rs::capi::ToStringRoundingOptions options, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::PlainTime* temporal_rs_PlainTime_clone(const temporal_rs::capi::PlainTime* self); @@ -93,177 +93,177 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::try_new_constrain(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_try_new_constrain(hour, - minute, - second, - millisecond, - microsecond, - nanosecond); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::try_new_constrain(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_try_new_constrain(hour, + minute, + second, + millisecond, + microsecond, + nanosecond); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::try_new(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_try_new(hour, - minute, - second, - millisecond, - microsecond, - nanosecond); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::try_new(uint8_t hour, uint8_t minute, uint8_t second, uint16_t millisecond, uint16_t microsecond, uint16_t nanosecond) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_try_new(hour, + minute, + second, + millisecond, + microsecond, + nanosecond); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_partial(temporal_rs::PartialTime partial, std::optional overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_from_partial(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_partial(temporal_rs::PartialTime partial, std::optional overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_from_partial(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_from_epoch_milliseconds(ms, - tz.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_from_epoch_milliseconds(ms, + tz.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_from_epoch_milliseconds_with_provider(ms, - tz.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_from_epoch_milliseconds_with_provider(ms, + tz.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::with(temporal_rs::PartialTime partial, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_with(this->AsFFI(), - partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::with(temporal_rs::PartialTime partial, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainTime_with(this->AsFFI(), + partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainTime_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline uint8_t temporal_rs::PlainTime::hour() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_hour(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_hour(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainTime::minute() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_minute(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_minute(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainTime::second() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_second(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_second(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainTime::millisecond() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_millisecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_millisecond(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainTime::microsecond() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_microsecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_microsecond(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainTime::nanosecond() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_nanosecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_nanosecond(this->AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::add(const temporal_rs::Duration& duration) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_add(this->AsFFI(), - duration.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::add(const temporal_rs::Duration& duration) const { + auto result = temporal_rs::capi::temporal_rs_PlainTime_add(this->AsFFI(), + duration.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::subtract(const temporal_rs::Duration& duration) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_subtract(this->AsFFI(), - duration.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::subtract(const temporal_rs::Duration& duration) const { + auto result = temporal_rs::capi::temporal_rs_PlainTime_subtract(this->AsFFI(), + duration.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::until(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_until(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::until(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainTime_until(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::since(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_since(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::since(const temporal_rs::PlainTime& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainTime_since(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::PlainTime::equals(const temporal_rs::PlainTime& other) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_equals(this->AsFFI(), + other.AsFFI()); + return result; } inline int8_t temporal_rs::PlainTime::compare(const temporal_rs::PlainTime& one, const temporal_rs::PlainTime& two) { - auto result = temporal_rs::capi::temporal_rs_PlainTime_compare(one.AsFFI(), - two.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainTime_compare(one.AsFFI(), + two.AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::round(temporal_rs::RoundingOptions options) const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_round(this->AsFFI(), - options.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainTime::round(temporal_rs::RoundingOptions options) const { + auto result = temporal_rs::capi::temporal_rs_PlainTime_round(this->AsFFI(), + options.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::PlainTime::to_ixdtf_string(temporal_rs::ToStringRoundingOptions options) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_PlainTime_to_ixdtf_string(this->AsFFI(), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainTime::to_ixdtf_string(temporal_rs::ToStringRoundingOptions options) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_PlainTime_to_ixdtf_string(this->AsFFI(), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::PlainTime::to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_PlainTime_to_ixdtf_string(this->AsFFI(), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainTime::to_ixdtf_string_write(temporal_rs::ToStringRoundingOptions options, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_PlainTime_to_ixdtf_string(this->AsFFI(), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::PlainTime::clone() const { - auto result = temporal_rs::capi::temporal_rs_PlainTime_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainTime_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainTime::FromFFI(result)); } inline const temporal_rs::capi::PlainTime* temporal_rs::PlainTime::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::PlainTime* temporal_rs::PlainTime::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::PlainTime* temporal_rs::PlainTime::FromFFI(const temporal_rs::capi::PlainTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::PlainTime* temporal_rs::PlainTime::FromFFI(temporal_rs::capi::PlainTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::PlainTime::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_PlainTime_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_PlainTime_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_PlainTime_HPP +#endif // TEMPORAL_RS_PlainTime_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.d.hpp index ae4934399..b6ea92483 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainYearMonth_D_HPP -#define temporal_rs_PlainYearMonth_D_HPP +#ifndef TEMPORAL_RS_PlainYearMonth_D_HPP +#define TEMPORAL_RS_PlainYearMonth_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Calendar; } class Calendar; @@ -31,7 +30,8 @@ struct TimeZone; class AnyCalendarKind; class ArithmeticOverflow; class DisplayCalendar; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -44,17 +44,17 @@ namespace temporal_rs { class PlainYearMonth { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new_with_overflow(int32_t year, uint8_t month, std::optional reference_day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_with_overflow(int32_t year, uint8_t month, std::optional reference_day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDate partial, std::optional overflow); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialDate partial, std::optional overflow); - inline static diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDate& parsed); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedDate& parsed); - inline diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDate partial, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialDate partial, std::optional overflow) const; - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s); inline int32_t year() const; @@ -80,23 +80,23 @@ class PlainYearMonth { inline const temporal_rs::Calendar& calendar() const; - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const; - inline diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const; inline bool equals(const temporal_rs::PlainYearMonth& other) const; inline static int8_t compare(const temporal_rs::PlainYearMonth& one, const temporal_rs::PlainYearMonth& two); - inline diplomat::result, temporal_rs::TemporalError> to_plain_date(std::optional day) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> to_plain_date(std::optional day) const; - inline diplomat::result epoch_ms_for(temporal_rs::TimeZone time_zone) const; + inline temporal_rs::diplomat::result epoch_ms_for(temporal_rs::TimeZone time_zone) const; - inline diplomat::result epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const; inline std::string to_ixdtf_string(temporal_rs::DisplayCalendar display_calendar) const; template @@ -104,19 +104,19 @@ class PlainYearMonth { inline std::unique_ptr clone() const; - inline const temporal_rs::capi::PlainYearMonth* AsFFI() const; - inline temporal_rs::capi::PlainYearMonth* AsFFI(); - inline static const temporal_rs::PlainYearMonth* FromFFI(const temporal_rs::capi::PlainYearMonth* ptr); - inline static temporal_rs::PlainYearMonth* FromFFI(temporal_rs::capi::PlainYearMonth* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::PlainYearMonth* AsFFI() const; + inline temporal_rs::capi::PlainYearMonth* AsFFI(); + inline static const temporal_rs::PlainYearMonth* FromFFI(const temporal_rs::capi::PlainYearMonth* ptr); + inline static temporal_rs::PlainYearMonth* FromFFI(temporal_rs::capi::PlainYearMonth* ptr); + inline static void operator delete(void* ptr); private: - PlainYearMonth() = delete; - PlainYearMonth(const temporal_rs::PlainYearMonth&) = delete; - PlainYearMonth(temporal_rs::PlainYearMonth&&) noexcept = delete; - PlainYearMonth operator=(const temporal_rs::PlainYearMonth&) = delete; - PlainYearMonth operator=(temporal_rs::PlainYearMonth&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + PlainYearMonth() = delete; + PlainYearMonth(const temporal_rs::PlainYearMonth&) = delete; + PlainYearMonth(temporal_rs::PlainYearMonth&&) noexcept = delete; + PlainYearMonth operator=(const temporal_rs::PlainYearMonth&) = delete; + PlainYearMonth operator=(temporal_rs::PlainYearMonth&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_PlainYearMonth_D_HPP +#endif // TEMPORAL_RS_PlainYearMonth_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.hpp b/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.hpp index 5011f1a08..5f66d553e 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/PlainYearMonth.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_PlainYearMonth_HPP -#define temporal_rs_PlainYearMonth_HPP +#ifndef TEMPORAL_RS_PlainYearMonth_HPP +#define TEMPORAL_RS_PlainYearMonth_HPP #include "PlainYearMonth.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" #include "ArithmeticOverflow.hpp" #include "Calendar.hpp" @@ -24,6 +23,7 @@ #include "Provider.hpp" #include "TemporalError.hpp" #include "TimeZone.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -31,7 +31,7 @@ namespace capi { extern "C" { typedef struct temporal_rs_PlainYearMonth_try_new_with_overflow_result {union {temporal_rs::capi::PlainYearMonth* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainYearMonth_try_new_with_overflow_result; - temporal_rs_PlainYearMonth_try_new_with_overflow_result temporal_rs_PlainYearMonth_try_new_with_overflow(int32_t year, uint8_t month, diplomat::capi::OptionU8 reference_day, temporal_rs::capi::AnyCalendarKind calendar, temporal_rs::capi::ArithmeticOverflow overflow); + temporal_rs_PlainYearMonth_try_new_with_overflow_result temporal_rs_PlainYearMonth_try_new_with_overflow(int32_t year, uint8_t month, temporal_rs::diplomat::capi::OptionU8 reference_day, temporal_rs::capi::AnyCalendarKind calendar, temporal_rs::capi::ArithmeticOverflow overflow); typedef struct temporal_rs_PlainYearMonth_from_partial_result {union {temporal_rs::capi::PlainYearMonth* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainYearMonth_from_partial_result; temporal_rs_PlainYearMonth_from_partial_result temporal_rs_PlainYearMonth_from_partial(temporal_rs::capi::PartialDate partial, temporal_rs::capi::ArithmeticOverflow_option overflow); @@ -43,16 +43,16 @@ namespace capi { temporal_rs_PlainYearMonth_with_result temporal_rs_PlainYearMonth_with(const temporal_rs::capi::PlainYearMonth* self, temporal_rs::capi::PartialDate partial, temporal_rs::capi::ArithmeticOverflow_option overflow); typedef struct temporal_rs_PlainYearMonth_from_utf8_result {union {temporal_rs::capi::PlainYearMonth* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainYearMonth_from_utf8_result; - temporal_rs_PlainYearMonth_from_utf8_result temporal_rs_PlainYearMonth_from_utf8(diplomat::capi::DiplomatStringView s); + temporal_rs_PlainYearMonth_from_utf8_result temporal_rs_PlainYearMonth_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s); typedef struct temporal_rs_PlainYearMonth_from_utf16_result {union {temporal_rs::capi::PlainYearMonth* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainYearMonth_from_utf16_result; - temporal_rs_PlainYearMonth_from_utf16_result temporal_rs_PlainYearMonth_from_utf16(diplomat::capi::DiplomatString16View s); + temporal_rs_PlainYearMonth_from_utf16_result temporal_rs_PlainYearMonth_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s); int32_t temporal_rs_PlainYearMonth_year(const temporal_rs::capi::PlainYearMonth* self); uint8_t temporal_rs_PlainYearMonth_month(const temporal_rs::capi::PlainYearMonth* self); - void temporal_rs_PlainYearMonth_month_code(const temporal_rs::capi::PlainYearMonth* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainYearMonth_month_code(const temporal_rs::capi::PlainYearMonth* self, temporal_rs::diplomat::capi::DiplomatWrite* write); bool temporal_rs_PlainYearMonth_in_leap_year(const temporal_rs::capi::PlainYearMonth* self); @@ -62,7 +62,7 @@ namespace capi { uint16_t temporal_rs_PlainYearMonth_months_in_year(const temporal_rs::capi::PlainYearMonth* self); - void temporal_rs_PlainYearMonth_era(const temporal_rs::capi::PlainYearMonth* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainYearMonth_era(const temporal_rs::capi::PlainYearMonth* self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_PlainYearMonth_era_year_result {union {int32_t ok; }; bool is_ok;} temporal_rs_PlainYearMonth_era_year_result; temporal_rs_PlainYearMonth_era_year_result temporal_rs_PlainYearMonth_era_year(const temporal_rs::capi::PlainYearMonth* self); @@ -94,7 +94,7 @@ namespace capi { typedef struct temporal_rs_PlainYearMonth_epoch_ms_for_with_provider_result {union {int64_t ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_PlainYearMonth_epoch_ms_for_with_provider_result; temporal_rs_PlainYearMonth_epoch_ms_for_with_provider_result temporal_rs_PlainYearMonth_epoch_ms_for_with_provider(const temporal_rs::capi::PlainYearMonth* self, temporal_rs::capi::TimeZone time_zone, const temporal_rs::capi::Provider* p); - void temporal_rs_PlainYearMonth_to_ixdtf_string(const temporal_rs::capi::PlainYearMonth* self, temporal_rs::capi::DisplayCalendar display_calendar, diplomat::capi::DiplomatWrite* write); + void temporal_rs_PlainYearMonth_to_ixdtf_string(const temporal_rs::capi::PlainYearMonth* self, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::PlainYearMonth* temporal_rs_PlainYearMonth_clone(const temporal_rs::capi::PlainYearMonth* self); @@ -104,210 +104,210 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::try_new_with_overflow(int32_t year, uint8_t month, std::optional reference_day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_try_new_with_overflow(year, - month, - reference_day.has_value() ? (diplomat::capi::OptionU8{ { reference_day.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - calendar.AsFFI(), - overflow.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::try_new_with_overflow(int32_t year, uint8_t month, std::optional reference_day, temporal_rs::AnyCalendarKind calendar, temporal_rs::ArithmeticOverflow overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_try_new_with_overflow(year, + month, + reference_day.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { reference_day.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + calendar.AsFFI(), + overflow.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_partial(temporal_rs::PartialDate partial, std::optional overflow) { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_partial(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_partial(temporal_rs::PartialDate partial, std::optional overflow) { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_partial(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_parsed(const temporal_rs::ParsedDate& parsed) { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_parsed(parsed.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_parsed(const temporal_rs::ParsedDate& parsed) { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_parsed(parsed.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::with(temporal_rs::PartialDate partial, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_with(this->AsFFI(), - partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::with(temporal_rs::PartialDate partial, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_with(this->AsFFI(), + partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_utf8(std::string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_utf8({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_utf8(std::string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_utf8({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_utf16(std::u16string_view s) { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_utf16({s.data(), s.size()}); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::from_utf16(std::u16string_view s) { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_from_utf16({s.data(), s.size()}); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline int32_t temporal_rs::PlainYearMonth::year() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_year(this->AsFFI()); + return result; } inline uint8_t temporal_rs::PlainYearMonth::month() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_month(this->AsFFI()); + return result; } inline std::string temporal_rs::PlainYearMonth::month_code() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainYearMonth_month_code(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainYearMonth_month_code(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainYearMonth::month_code_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainYearMonth_month_code(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainYearMonth_month_code(this->AsFFI(), + &write); } inline bool temporal_rs::PlainYearMonth::in_leap_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_in_leap_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_in_leap_year(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainYearMonth::days_in_month() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_days_in_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_days_in_month(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainYearMonth::days_in_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_days_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_days_in_year(this->AsFFI()); + return result; } inline uint16_t temporal_rs::PlainYearMonth::months_in_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_months_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_months_in_year(this->AsFFI()); + return result; } inline std::string temporal_rs::PlainYearMonth::era() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainYearMonth_era(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainYearMonth_era(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainYearMonth::era_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainYearMonth_era(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainYearMonth_era(this->AsFFI(), + &write); } inline std::optional temporal_rs::PlainYearMonth::era_year() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_era_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_era_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline const temporal_rs::Calendar& temporal_rs::PlainYearMonth::calendar() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_calendar(this->AsFFI()); - return *temporal_rs::Calendar::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_calendar(this->AsFFI()); + return *temporal_rs::Calendar::FromFFI(result); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::add(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_add(this->AsFFI(), - duration.AsFFI(), - overflow.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::add(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_add(this->AsFFI(), + duration.AsFFI(), + overflow.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::subtract(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_subtract(this->AsFFI(), - duration.AsFFI(), - overflow.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::subtract(const temporal_rs::Duration& duration, temporal_rs::ArithmeticOverflow overflow) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_subtract(this->AsFFI(), + duration.AsFFI(), + overflow.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::until(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_until(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::until(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_until(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::since(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_since(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::since(const temporal_rs::PlainYearMonth& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_since(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline bool temporal_rs::PlainYearMonth::equals(const temporal_rs::PlainYearMonth& other) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_equals(this->AsFFI(), + other.AsFFI()); + return result; } inline int8_t temporal_rs::PlainYearMonth::compare(const temporal_rs::PlainYearMonth& one, const temporal_rs::PlainYearMonth& two) { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_compare(one.AsFFI(), - two.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_compare(one.AsFFI(), + two.AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::to_plain_date(std::optional day) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_to_plain_date(this->AsFFI(), - day.has_value() ? (temporal_rs::capi::PartialDate_option{ { day.value().AsFFI() }, true }) : (temporal_rs::capi::PartialDate_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::PlainYearMonth::to_plain_date(std::optional day) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_to_plain_date(this->AsFFI(), + day.has_value() ? (temporal_rs::capi::PartialDate_option{ { day.value().AsFFI() }, true }) : (temporal_rs::capi::PartialDate_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::PlainDate::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::PlainYearMonth::epoch_ms_for(temporal_rs::TimeZone time_zone) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_epoch_ms_for(this->AsFFI(), - time_zone.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainYearMonth::epoch_ms_for(temporal_rs::TimeZone time_zone) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_epoch_ms_for(this->AsFFI(), + time_zone.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::PlainYearMonth::epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_epoch_ms_for_with_provider(this->AsFFI(), - time_zone.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::PlainYearMonth::epoch_ms_for_with_provider(temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_epoch_ms_for_with_provider(this->AsFFI(), + time_zone.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::string temporal_rs::PlainYearMonth::to_ixdtf_string(temporal_rs::DisplayCalendar display_calendar) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_PlainYearMonth_to_ixdtf_string(this->AsFFI(), - display_calendar.AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_PlainYearMonth_to_ixdtf_string(this->AsFFI(), + display_calendar.AsFFI(), + &write); + return output; } template inline void temporal_rs::PlainYearMonth::to_ixdtf_string_write(temporal_rs::DisplayCalendar display_calendar, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_PlainYearMonth_to_ixdtf_string(this->AsFFI(), - display_calendar.AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_PlainYearMonth_to_ixdtf_string(this->AsFFI(), + display_calendar.AsFFI(), + &write); } inline std::unique_ptr temporal_rs::PlainYearMonth::clone() const { - auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_PlainYearMonth_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainYearMonth::FromFFI(result)); } inline const temporal_rs::capi::PlainYearMonth* temporal_rs::PlainYearMonth::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::PlainYearMonth* temporal_rs::PlainYearMonth::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::PlainYearMonth* temporal_rs::PlainYearMonth::FromFFI(const temporal_rs::capi::PlainYearMonth* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::PlainYearMonth* temporal_rs::PlainYearMonth::FromFFI(temporal_rs::capi::PlainYearMonth* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::PlainYearMonth::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_PlainYearMonth_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_PlainYearMonth_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_PlainYearMonth_HPP +#endif // TEMPORAL_RS_PlainYearMonth_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Precision.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Precision.d.hpp index 7a47831d1..fc8ff6c93 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Precision.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Precision.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Precision_D_HPP -#define temporal_rs_Precision_D_HPP +#ifndef TEMPORAL_RS_Precision_D_HPP +#define TEMPORAL_RS_Precision_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Precision { bool is_minute; - diplomat::capi::OptionU8 precision; + temporal_rs::diplomat::capi::OptionU8 precision; }; typedef struct Precision_option {union { Precision ok; }; bool is_ok; } Precision_option; @@ -26,12 +26,12 @@ namespace capi { namespace temporal_rs { struct Precision { - bool is_minute; - std::optional precision; + bool is_minute; + std::optional precision; - inline temporal_rs::capi::Precision AsFFI() const; - inline static temporal_rs::Precision FromFFI(temporal_rs::capi::Precision c_struct); + inline temporal_rs::capi::Precision AsFFI() const; + inline static temporal_rs::Precision FromFFI(temporal_rs::capi::Precision c_struct); }; } // namespace -#endif // temporal_rs_Precision_D_HPP +#endif // TEMPORAL_RS_Precision_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Precision.hpp b/temporal_capi/bindings/cpp/temporal_rs/Precision.hpp index 8a8d97f7c..798021ca9 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Precision.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Precision.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Precision_HPP -#define temporal_rs_Precision_HPP +#ifndef TEMPORAL_RS_Precision_HPP +#define TEMPORAL_RS_Precision_HPP #include "Precision.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -24,18 +24,18 @@ namespace capi { inline temporal_rs::capi::Precision temporal_rs::Precision::AsFFI() const { - return temporal_rs::capi::Precision { - /* .is_minute = */ is_minute, - /* .precision = */ precision.has_value() ? (diplomat::capi::OptionU8{ { precision.value() }, true }) : (diplomat::capi::OptionU8{ {}, false }), - }; + return temporal_rs::capi::Precision { + /* .is_minute = */ is_minute, + /* .precision = */ precision.has_value() ? (temporal_rs::diplomat::capi::OptionU8{ { precision.value() }, true }) : (temporal_rs::diplomat::capi::OptionU8{ {}, false }), + }; } inline temporal_rs::Precision temporal_rs::Precision::FromFFI(temporal_rs::capi::Precision c_struct) { - return temporal_rs::Precision { - /* .is_minute = */ c_struct.is_minute, - /* .precision = */ c_struct.precision.is_ok ? std::optional(c_struct.precision.ok) : std::nullopt, - }; + return temporal_rs::Precision { + /* .is_minute = */ c_struct.is_minute, + /* .precision = */ c_struct.precision.is_ok ? std::optional(c_struct.precision.ok) : std::nullopt, + }; } -#endif // temporal_rs_Precision_HPP +#endif // TEMPORAL_RS_Precision_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Provider.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Provider.d.hpp index 84737f2c7..00cd6c29f 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Provider.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Provider.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Provider_D_HPP -#define temporal_rs_Provider_D_HPP +#ifndef TEMPORAL_RS_Provider_D_HPP +#define TEMPORAL_RS_Provider_D_HPP #include #include @@ -9,12 +9,12 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Provider; } class Provider; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -30,33 +30,33 @@ namespace temporal_rs { class Provider { public: - /** - * Construct a provider backed by a zoneinfo64.res file - * - * This failing to construct is not a Temporal error, so it just returns () - */ - inline static diplomat::result, std::monostate> new_zoneinfo64(diplomat::span data); + /** + * Construct a provider backed by a zoneinfo64.res file + * + * This failing to construct is not a Temporal error, so it just returns () + */ + inline static temporal_rs::diplomat::result, std::monostate> new_zoneinfo64(temporal_rs::diplomat::span data); inline static std::unique_ptr new_compiled(); - /** - * Fallback type in case construction does not work. - */ + /** + * Fallback type in case construction does not work. + */ inline static std::unique_ptr empty(); - inline const temporal_rs::capi::Provider* AsFFI() const; - inline temporal_rs::capi::Provider* AsFFI(); - inline static const temporal_rs::Provider* FromFFI(const temporal_rs::capi::Provider* ptr); - inline static temporal_rs::Provider* FromFFI(temporal_rs::capi::Provider* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::Provider* AsFFI() const; + inline temporal_rs::capi::Provider* AsFFI(); + inline static const temporal_rs::Provider* FromFFI(const temporal_rs::capi::Provider* ptr); + inline static temporal_rs::Provider* FromFFI(temporal_rs::capi::Provider* ptr); + inline static void operator delete(void* ptr); private: - Provider() = delete; - Provider(const temporal_rs::Provider&) = delete; - Provider(temporal_rs::Provider&&) noexcept = delete; - Provider operator=(const temporal_rs::Provider&) = delete; - Provider operator=(temporal_rs::Provider&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + Provider() = delete; + Provider(const temporal_rs::Provider&) = delete; + Provider(temporal_rs::Provider&&) noexcept = delete; + Provider operator=(const temporal_rs::Provider&) = delete; + Provider operator=(temporal_rs::Provider&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_Provider_D_HPP +#endif // TEMPORAL_RS_Provider_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Provider.hpp b/temporal_capi/bindings/cpp/temporal_rs/Provider.hpp index ea25bd168..c01662f0a 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Provider.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Provider.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Provider_HPP -#define temporal_rs_Provider_HPP +#ifndef TEMPORAL_RS_Provider_HPP +#define TEMPORAL_RS_Provider_HPP #include "Provider.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -19,7 +19,7 @@ namespace capi { extern "C" { typedef struct temporal_rs_Provider_new_zoneinfo64_result {union {temporal_rs::capi::Provider* ok; }; bool is_ok;} temporal_rs_Provider_new_zoneinfo64_result; - temporal_rs_Provider_new_zoneinfo64_result temporal_rs_Provider_new_zoneinfo64(diplomat::capi::DiplomatU32View data); + temporal_rs_Provider_new_zoneinfo64_result temporal_rs_Provider_new_zoneinfo64(temporal_rs::diplomat::capi::DiplomatU32View data); temporal_rs::capi::Provider* temporal_rs_Provider_new_compiled(void); @@ -31,40 +31,40 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, std::monostate> temporal_rs::Provider::new_zoneinfo64(diplomat::span data) { - auto result = temporal_rs::capi::temporal_rs_Provider_new_zoneinfo64({data.data(), data.size()}); - return result.is_ok ? diplomat::result, std::monostate>(diplomat::Ok>(std::unique_ptr(temporal_rs::Provider::FromFFI(result.ok)))) : diplomat::result, std::monostate>(diplomat::Err()); +inline temporal_rs::diplomat::result, std::monostate> temporal_rs::Provider::new_zoneinfo64(temporal_rs::diplomat::span data) { + auto result = temporal_rs::capi::temporal_rs_Provider_new_zoneinfo64({data.data(), data.size()}); + return result.is_ok ? temporal_rs::diplomat::result, std::monostate>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Provider::FromFFI(result.ok)))) : temporal_rs::diplomat::result, std::monostate>(temporal_rs::diplomat::Err()); } inline std::unique_ptr temporal_rs::Provider::new_compiled() { - auto result = temporal_rs::capi::temporal_rs_Provider_new_compiled(); - return std::unique_ptr(temporal_rs::Provider::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Provider_new_compiled(); + return std::unique_ptr(temporal_rs::Provider::FromFFI(result)); } inline std::unique_ptr temporal_rs::Provider::empty() { - auto result = temporal_rs::capi::temporal_rs_Provider_empty(); - return std::unique_ptr(temporal_rs::Provider::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_Provider_empty(); + return std::unique_ptr(temporal_rs::Provider::FromFFI(result)); } inline const temporal_rs::capi::Provider* temporal_rs::Provider::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::Provider* temporal_rs::Provider::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::Provider* temporal_rs::Provider::FromFFI(const temporal_rs::capi::Provider* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::Provider* temporal_rs::Provider::FromFFI(temporal_rs::capi::Provider* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::Provider::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_Provider_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_Provider_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_Provider_HPP +#endif // TEMPORAL_RS_Provider_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.d.hpp index 7043c5ac0..8c3b80d68 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_RelativeTo_D_HPP -#define temporal_rs_RelativeTo_D_HPP +#ifndef TEMPORAL_RS_RelativeTo_D_HPP +#define TEMPORAL_RS_RelativeTo_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct PlainDate; } class PlainDate; namespace capi { struct ZonedDateTime; } class ZonedDateTime; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -33,12 +33,12 @@ namespace capi { namespace temporal_rs { struct RelativeTo { - const temporal_rs::PlainDate* date; - const temporal_rs::ZonedDateTime* zoned; + const temporal_rs::PlainDate* date; + const temporal_rs::ZonedDateTime* zoned; - inline temporal_rs::capi::RelativeTo AsFFI() const; - inline static temporal_rs::RelativeTo FromFFI(temporal_rs::capi::RelativeTo c_struct); + inline temporal_rs::capi::RelativeTo AsFFI() const; + inline static temporal_rs::RelativeTo FromFFI(temporal_rs::capi::RelativeTo c_struct); }; } // namespace -#endif // temporal_rs_RelativeTo_D_HPP +#endif // TEMPORAL_RS_RelativeTo_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.hpp b/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.hpp index c7927cdf3..a5f28a56c 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/RelativeTo.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_RelativeTo_HPP -#define temporal_rs_RelativeTo_HPP +#ifndef TEMPORAL_RS_RelativeTo_HPP +#define TEMPORAL_RS_RelativeTo_HPP #include "RelativeTo.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "PlainDate.hpp" #include "ZonedDateTime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,18 +26,18 @@ namespace capi { inline temporal_rs::capi::RelativeTo temporal_rs::RelativeTo::AsFFI() const { - return temporal_rs::capi::RelativeTo { - /* .date = */ date ? date->AsFFI() : nullptr, - /* .zoned = */ zoned ? zoned->AsFFI() : nullptr, - }; + return temporal_rs::capi::RelativeTo { + /* .date = */ date ? date->AsFFI() : nullptr, + /* .zoned = */ zoned ? zoned->AsFFI() : nullptr, + }; } inline temporal_rs::RelativeTo temporal_rs::RelativeTo::FromFFI(temporal_rs::capi::RelativeTo c_struct) { - return temporal_rs::RelativeTo { - /* .date = */ temporal_rs::PlainDate::FromFFI(c_struct.date), - /* .zoned = */ temporal_rs::ZonedDateTime::FromFFI(c_struct.zoned), - }; + return temporal_rs::RelativeTo { + /* .date = */ temporal_rs::PlainDate::FromFFI(c_struct.date), + /* .zoned = */ temporal_rs::ZonedDateTime::FromFFI(c_struct.zoned), + }; } -#endif // temporal_rs_RelativeTo_HPP +#endif // TEMPORAL_RS_RelativeTo_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.d.hpp index 58ff1ebe8..a8ceeb790 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_RoundingMode_D_HPP -#define temporal_rs_RoundingMode_D_HPP +#ifndef TEMPORAL_RS_RoundingMode_D_HPP +#define TEMPORAL_RS_RoundingMode_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -33,31 +33,31 @@ namespace capi { namespace temporal_rs { class RoundingMode { public: - enum Value { - Ceil = 0, - Floor = 1, - Expand = 2, - Trunc = 3, - HalfCeil = 4, - HalfFloor = 5, - HalfExpand = 6, - HalfTrunc = 7, - HalfEven = 8, - }; - - RoundingMode(): value(Value::Ceil) {} - - // Implicit conversions between enum and ::Value - constexpr RoundingMode(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::RoundingMode AsFFI() const; - inline static temporal_rs::RoundingMode FromFFI(temporal_rs::capi::RoundingMode c_enum); + enum Value { + Ceil = 0, + Floor = 1, + Expand = 2, + Trunc = 3, + HalfCeil = 4, + HalfFloor = 5, + HalfExpand = 6, + HalfTrunc = 7, + HalfEven = 8, + }; + + RoundingMode(): value(Value::Ceil) {} + + // Implicit conversions between enum and ::Value + constexpr RoundingMode(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::RoundingMode AsFFI() const; + inline static temporal_rs::RoundingMode FromFFI(temporal_rs::capi::RoundingMode c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_RoundingMode_D_HPP +#endif // TEMPORAL_RS_RoundingMode_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.hpp b/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.hpp index cce2b6276..7d5b92531 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/RoundingMode.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_RoundingMode_HPP -#define temporal_rs_RoundingMode_HPP +#ifndef TEMPORAL_RS_RoundingMode_HPP +#define TEMPORAL_RS_RoundingMode_HPP #include "RoundingMode.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,23 +23,23 @@ namespace capi { } // namespace inline temporal_rs::capi::RoundingMode temporal_rs::RoundingMode::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::RoundingMode temporal_rs::RoundingMode::FromFFI(temporal_rs::capi::RoundingMode c_enum) { - switch (c_enum) { - case temporal_rs::capi::RoundingMode_Ceil: - case temporal_rs::capi::RoundingMode_Floor: - case temporal_rs::capi::RoundingMode_Expand: - case temporal_rs::capi::RoundingMode_Trunc: - case temporal_rs::capi::RoundingMode_HalfCeil: - case temporal_rs::capi::RoundingMode_HalfFloor: - case temporal_rs::capi::RoundingMode_HalfExpand: - case temporal_rs::capi::RoundingMode_HalfTrunc: - case temporal_rs::capi::RoundingMode_HalfEven: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::RoundingMode_Ceil: + case temporal_rs::capi::RoundingMode_Floor: + case temporal_rs::capi::RoundingMode_Expand: + case temporal_rs::capi::RoundingMode_Trunc: + case temporal_rs::capi::RoundingMode_HalfCeil: + case temporal_rs::capi::RoundingMode_HalfFloor: + case temporal_rs::capi::RoundingMode_HalfExpand: + case temporal_rs::capi::RoundingMode_HalfTrunc: + case temporal_rs::capi::RoundingMode_HalfEven: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_RoundingMode_HPP +#endif // TEMPORAL_RS_RoundingMode_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.d.hpp index 4ccb10ea0..13256ac33 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_RoundingOptions_D_HPP -#define temporal_rs_RoundingOptions_D_HPP +#ifndef TEMPORAL_RS_RoundingOptions_D_HPP +#define TEMPORAL_RS_RoundingOptions_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "RoundingMode.d.hpp" #include "Unit.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { class RoundingMode; class Unit; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -25,7 +25,7 @@ namespace capi { temporal_rs::capi::Unit_option largest_unit; temporal_rs::capi::Unit_option smallest_unit; temporal_rs::capi::RoundingMode_option rounding_mode; - diplomat::capi::OptionU32 increment; + temporal_rs::diplomat::capi::OptionU32 increment; }; typedef struct RoundingOptions_option {union { RoundingOptions ok; }; bool is_ok; } RoundingOptions_option; @@ -35,14 +35,14 @@ namespace capi { namespace temporal_rs { struct RoundingOptions { - std::optional largest_unit; - std::optional smallest_unit; - std::optional rounding_mode; - std::optional increment; + std::optional largest_unit; + std::optional smallest_unit; + std::optional rounding_mode; + std::optional increment; - inline temporal_rs::capi::RoundingOptions AsFFI() const; - inline static temporal_rs::RoundingOptions FromFFI(temporal_rs::capi::RoundingOptions c_struct); + inline temporal_rs::capi::RoundingOptions AsFFI() const; + inline static temporal_rs::RoundingOptions FromFFI(temporal_rs::capi::RoundingOptions c_struct); }; } // namespace -#endif // temporal_rs_RoundingOptions_D_HPP +#endif // TEMPORAL_RS_RoundingOptions_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.hpp b/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.hpp index e19a8439b..1804f7be4 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/RoundingOptions.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_RoundingOptions_HPP -#define temporal_rs_RoundingOptions_HPP +#ifndef TEMPORAL_RS_RoundingOptions_HPP +#define TEMPORAL_RS_RoundingOptions_HPP #include "RoundingOptions.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "RoundingMode.hpp" #include "Unit.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,22 +26,22 @@ namespace capi { inline temporal_rs::capi::RoundingOptions temporal_rs::RoundingOptions::AsFFI() const { - return temporal_rs::capi::RoundingOptions { - /* .largest_unit = */ largest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { largest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), - /* .smallest_unit = */ smallest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { smallest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), - /* .rounding_mode = */ rounding_mode.has_value() ? (temporal_rs::capi::RoundingMode_option{ { rounding_mode.value().AsFFI() }, true }) : (temporal_rs::capi::RoundingMode_option{ {}, false }), - /* .increment = */ increment.has_value() ? (diplomat::capi::OptionU32{ { increment.value() }, true }) : (diplomat::capi::OptionU32{ {}, false }), - }; + return temporal_rs::capi::RoundingOptions { + /* .largest_unit = */ largest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { largest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), + /* .smallest_unit = */ smallest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { smallest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), + /* .rounding_mode = */ rounding_mode.has_value() ? (temporal_rs::capi::RoundingMode_option{ { rounding_mode.value().AsFFI() }, true }) : (temporal_rs::capi::RoundingMode_option{ {}, false }), + /* .increment = */ increment.has_value() ? (temporal_rs::diplomat::capi::OptionU32{ { increment.value() }, true }) : (temporal_rs::diplomat::capi::OptionU32{ {}, false }), + }; } inline temporal_rs::RoundingOptions temporal_rs::RoundingOptions::FromFFI(temporal_rs::capi::RoundingOptions c_struct) { - return temporal_rs::RoundingOptions { - /* .largest_unit = */ c_struct.largest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.largest_unit.ok)) : std::nullopt, - /* .smallest_unit = */ c_struct.smallest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.smallest_unit.ok)) : std::nullopt, - /* .rounding_mode = */ c_struct.rounding_mode.is_ok ? std::optional(temporal_rs::RoundingMode::FromFFI(c_struct.rounding_mode.ok)) : std::nullopt, - /* .increment = */ c_struct.increment.is_ok ? std::optional(c_struct.increment.ok) : std::nullopt, - }; + return temporal_rs::RoundingOptions { + /* .largest_unit = */ c_struct.largest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.largest_unit.ok)) : std::nullopt, + /* .smallest_unit = */ c_struct.smallest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.smallest_unit.ok)) : std::nullopt, + /* .rounding_mode = */ c_struct.rounding_mode.is_ok ? std::optional(temporal_rs::RoundingMode::FromFFI(c_struct.rounding_mode.ok)) : std::nullopt, + /* .increment = */ c_struct.increment.is_ok ? std::optional(c_struct.increment.ok) : std::nullopt, + }; } -#endif // temporal_rs_RoundingOptions_HPP +#endif // TEMPORAL_RS_RoundingOptions_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Sign.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Sign.d.hpp index ad11e12b8..26bd59e56 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Sign.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Sign.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Sign_D_HPP -#define temporal_rs_Sign_D_HPP +#ifndef TEMPORAL_RS_Sign_D_HPP +#define TEMPORAL_RS_Sign_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -27,25 +27,25 @@ namespace capi { namespace temporal_rs { class Sign { public: - enum Value { - Positive = 1, - Zero = 0, - Negative = -1, - }; - - Sign(): value(Value::Zero) {} - - // Implicit conversions between enum and ::Value - constexpr Sign(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::Sign AsFFI() const; - inline static temporal_rs::Sign FromFFI(temporal_rs::capi::Sign c_enum); + enum Value { + Positive = 1, + Zero = 0, + Negative = -1, + }; + + Sign(): value(Value::Zero) {} + + // Implicit conversions between enum and ::Value + constexpr Sign(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::Sign AsFFI() const; + inline static temporal_rs::Sign FromFFI(temporal_rs::capi::Sign c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_Sign_D_HPP +#endif // TEMPORAL_RS_Sign_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Sign.hpp b/temporal_capi/bindings/cpp/temporal_rs/Sign.hpp index 0d55b00e5..131b59507 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Sign.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Sign.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Sign_HPP -#define temporal_rs_Sign_HPP +#ifndef TEMPORAL_RS_Sign_HPP +#define TEMPORAL_RS_Sign_HPP #include "Sign.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,17 +23,17 @@ namespace capi { } // namespace inline temporal_rs::capi::Sign temporal_rs::Sign::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::Sign temporal_rs::Sign::FromFFI(temporal_rs::capi::Sign c_enum) { - switch (c_enum) { - case temporal_rs::capi::Sign_Positive: - case temporal_rs::capi::Sign_Zero: - case temporal_rs::capi::Sign_Negative: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::Sign_Positive: + case temporal_rs::capi::Sign_Zero: + case temporal_rs::capi::Sign_Negative: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_Sign_HPP +#endif // TEMPORAL_RS_Sign_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/TemporalError.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/TemporalError.d.hpp index 05d57287e..e07208d80 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/TemporalError.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/TemporalError.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_TemporalError_D_HPP -#define temporal_rs_TemporalError_D_HPP +#ifndef TEMPORAL_RS_TemporalError_D_HPP +#define TEMPORAL_RS_TemporalError_D_HPP #include #include @@ -9,19 +9,19 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "ErrorKind.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { class ErrorKind; -} +} // namespace temporal_rs + namespace temporal_rs { namespace capi { struct TemporalError { temporal_rs::capi::ErrorKind kind; - diplomat::capi::OptionStringView msg; + temporal_rs::diplomat::capi::OptionStringView msg; }; typedef struct TemporalError_option {union { TemporalError ok; }; bool is_ok; } TemporalError_option; @@ -31,12 +31,12 @@ namespace capi { namespace temporal_rs { struct TemporalError { - temporal_rs::ErrorKind kind; - std::optional msg; + temporal_rs::ErrorKind kind; + std::optional msg; - inline temporal_rs::capi::TemporalError AsFFI() const; - inline static temporal_rs::TemporalError FromFFI(temporal_rs::capi::TemporalError c_struct); + inline temporal_rs::capi::TemporalError AsFFI() const; + inline static temporal_rs::TemporalError FromFFI(temporal_rs::capi::TemporalError c_struct); }; } // namespace -#endif // temporal_rs_TemporalError_D_HPP +#endif // TEMPORAL_RS_TemporalError_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/TemporalError.hpp b/temporal_capi/bindings/cpp/temporal_rs/TemporalError.hpp index eb8dc32f7..aaccd0c19 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/TemporalError.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/TemporalError.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_TemporalError_HPP -#define temporal_rs_TemporalError_HPP +#ifndef TEMPORAL_RS_TemporalError_HPP +#define TEMPORAL_RS_TemporalError_HPP #include "TemporalError.d.hpp" @@ -11,8 +11,8 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "ErrorKind.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -25,18 +25,18 @@ namespace capi { inline temporal_rs::capi::TemporalError temporal_rs::TemporalError::AsFFI() const { - return temporal_rs::capi::TemporalError { - /* .kind = */ kind.AsFFI(), - /* .msg = */ msg.has_value() ? (diplomat::capi::OptionStringView{ { {msg.value().data(), msg.value().size()} }, true }) : (diplomat::capi::OptionStringView{ {}, false }), - }; + return temporal_rs::capi::TemporalError { + /* .kind = */ kind.AsFFI(), + /* .msg = */ msg.has_value() ? (temporal_rs::diplomat::capi::OptionStringView{ { {msg.value().data(), msg.value().size()} }, true }) : (temporal_rs::diplomat::capi::OptionStringView{ {}, false }), + }; } inline temporal_rs::TemporalError temporal_rs::TemporalError::FromFFI(temporal_rs::capi::TemporalError c_struct) { - return temporal_rs::TemporalError { - /* .kind = */ temporal_rs::ErrorKind::FromFFI(c_struct.kind), - /* .msg = */ c_struct.msg.is_ok ? std::optional(std::string_view(c_struct.msg.ok.data, c_struct.msg.ok.len)) : std::nullopt, - }; + return temporal_rs::TemporalError { + /* .kind = */ temporal_rs::ErrorKind::FromFFI(c_struct.kind), + /* .msg = */ c_struct.msg.is_ok ? std::optional(std::string_view(c_struct.msg.ok.data, c_struct.msg.ok.len)) : std::nullopt, + }; } -#endif // temporal_rs_TemporalError_HPP +#endif // TEMPORAL_RS_TemporalError_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/TimeZone.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/TimeZone.d.hpp index d9765acd9..3cc21843d 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/TimeZone.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/TimeZone.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_TimeZone_D_HPP -#define temporal_rs_TimeZone_D_HPP +#ifndef TEMPORAL_RS_TimeZone_D_HPP +#define TEMPORAL_RS_TimeZone_D_HPP #include #include @@ -9,14 +9,14 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Provider; } class Provider; struct TemporalError; struct TimeZone; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -40,51 +40,51 @@ namespace temporal_rs { * It is not recommended to directly manipulate the fields of this type. */ struct TimeZone { - int16_t offset_minutes; - size_t resolved_id; - size_t normalized_id; - bool is_iana_id; + int16_t offset_minutes; + size_t resolved_id; + size_t normalized_id; + bool is_iana_id; - inline static diplomat::result try_from_identifier_str(std::string_view ident); + inline static temporal_rs::diplomat::result try_from_identifier_str(std::string_view ident); - inline static diplomat::result try_from_identifier_str_with_provider(std::string_view ident, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result try_from_identifier_str_with_provider(std::string_view ident, const temporal_rs::Provider& p); - inline static diplomat::result try_from_offset_str(std::string_view ident); + inline static temporal_rs::diplomat::result try_from_offset_str(std::string_view ident); - inline static diplomat::result try_from_str(std::string_view ident); + inline static temporal_rs::diplomat::result try_from_str(std::string_view ident); - inline static diplomat::result try_from_str_with_provider(std::string_view ident, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result try_from_str_with_provider(std::string_view ident, const temporal_rs::Provider& p); inline std::string identifier() const; template inline void identifier_write(W& writeable_output) const; - inline diplomat::result identifier_with_provider(const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result identifier_with_provider(const temporal_rs::Provider& p) const; template - inline diplomat::result identifier_with_provider_write(const temporal_rs::Provider& p, W& writeable_output) const; + inline temporal_rs::diplomat::result identifier_with_provider_write(const temporal_rs::Provider& p, W& writeable_output) const; inline static temporal_rs::TimeZone utc(); - inline static diplomat::result utc_with_provider(const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result utc_with_provider(const temporal_rs::Provider& p); - /** - * Create a TimeZone that represents +00:00 - * - * This is the only way to infallibly make a TimeZone without compiled_data, - * and can be used as a fallback. - */ + /** + * Create a TimeZone that represents +00:00 + * + * This is the only way to infallibly make a TimeZone without compiled_data, + * and can be used as a fallback. + */ inline static temporal_rs::TimeZone zero(); - /** - * Get the primary time zone identifier corresponding to this time zone - */ - inline diplomat::result primary_identifier() const; + /** + * Get the primary time zone identifier corresponding to this time zone + */ + inline temporal_rs::diplomat::result primary_identifier() const; - inline diplomat::result primary_identifier_with_provider(const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result primary_identifier_with_provider(const temporal_rs::Provider& p) const; - inline temporal_rs::capi::TimeZone AsFFI() const; - inline static temporal_rs::TimeZone FromFFI(temporal_rs::capi::TimeZone c_struct); + inline temporal_rs::capi::TimeZone AsFFI() const; + inline static temporal_rs::TimeZone FromFFI(temporal_rs::capi::TimeZone c_struct); }; } // namespace -#endif // temporal_rs_TimeZone_D_HPP +#endif // TEMPORAL_RS_TimeZone_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/TimeZone.hpp b/temporal_capi/bindings/cpp/temporal_rs/TimeZone.hpp index dd7b37b01..83f78af6b 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/TimeZone.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/TimeZone.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_TimeZone_HPP -#define temporal_rs_TimeZone_HPP +#ifndef TEMPORAL_RS_TimeZone_HPP +#define TEMPORAL_RS_TimeZone_HPP #include "TimeZone.d.hpp" @@ -11,9 +11,9 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "Provider.hpp" #include "TemporalError.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -21,24 +21,24 @@ namespace capi { extern "C" { typedef struct temporal_rs_TimeZone_try_from_identifier_str_result {union {temporal_rs::capi::TimeZone ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_TimeZone_try_from_identifier_str_result; - temporal_rs_TimeZone_try_from_identifier_str_result temporal_rs_TimeZone_try_from_identifier_str(diplomat::capi::DiplomatStringView ident); + temporal_rs_TimeZone_try_from_identifier_str_result temporal_rs_TimeZone_try_from_identifier_str(temporal_rs::diplomat::capi::DiplomatStringView ident); typedef struct temporal_rs_TimeZone_try_from_identifier_str_with_provider_result {union {temporal_rs::capi::TimeZone ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_TimeZone_try_from_identifier_str_with_provider_result; - temporal_rs_TimeZone_try_from_identifier_str_with_provider_result temporal_rs_TimeZone_try_from_identifier_str_with_provider(diplomat::capi::DiplomatStringView ident, const temporal_rs::capi::Provider* p); + temporal_rs_TimeZone_try_from_identifier_str_with_provider_result temporal_rs_TimeZone_try_from_identifier_str_with_provider(temporal_rs::diplomat::capi::DiplomatStringView ident, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_TimeZone_try_from_offset_str_result {union {temporal_rs::capi::TimeZone ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_TimeZone_try_from_offset_str_result; - temporal_rs_TimeZone_try_from_offset_str_result temporal_rs_TimeZone_try_from_offset_str(diplomat::capi::DiplomatStringView ident); + temporal_rs_TimeZone_try_from_offset_str_result temporal_rs_TimeZone_try_from_offset_str(temporal_rs::diplomat::capi::DiplomatStringView ident); typedef struct temporal_rs_TimeZone_try_from_str_result {union {temporal_rs::capi::TimeZone ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_TimeZone_try_from_str_result; - temporal_rs_TimeZone_try_from_str_result temporal_rs_TimeZone_try_from_str(diplomat::capi::DiplomatStringView ident); + temporal_rs_TimeZone_try_from_str_result temporal_rs_TimeZone_try_from_str(temporal_rs::diplomat::capi::DiplomatStringView ident); typedef struct temporal_rs_TimeZone_try_from_str_with_provider_result {union {temporal_rs::capi::TimeZone ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_TimeZone_try_from_str_with_provider_result; - temporal_rs_TimeZone_try_from_str_with_provider_result temporal_rs_TimeZone_try_from_str_with_provider(diplomat::capi::DiplomatStringView ident, const temporal_rs::capi::Provider* p); + temporal_rs_TimeZone_try_from_str_with_provider_result temporal_rs_TimeZone_try_from_str_with_provider(temporal_rs::diplomat::capi::DiplomatStringView ident, const temporal_rs::capi::Provider* p); - void temporal_rs_TimeZone_identifier(temporal_rs::capi::TimeZone self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_TimeZone_identifier(temporal_rs::capi::TimeZone self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_TimeZone_identifier_with_provider_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_TimeZone_identifier_with_provider_result; - temporal_rs_TimeZone_identifier_with_provider_result temporal_rs_TimeZone_identifier_with_provider(temporal_rs::capi::TimeZone self, const temporal_rs::capi::Provider* p, diplomat::capi::DiplomatWrite* write); + temporal_rs_TimeZone_identifier_with_provider_result temporal_rs_TimeZone_identifier_with_provider(temporal_rs::capi::TimeZone self, const temporal_rs::capi::Provider* p, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::TimeZone temporal_rs_TimeZone_utc(void); @@ -57,108 +57,108 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result temporal_rs::TimeZone::try_from_identifier_str(std::string_view ident) { - auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_identifier_str({ident.data(), ident.size()}); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::try_from_identifier_str(std::string_view ident) { + auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_identifier_str({ident.data(), ident.size()}); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::TimeZone::try_from_identifier_str_with_provider(std::string_view ident, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_identifier_str_with_provider({ident.data(), ident.size()}, - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::try_from_identifier_str_with_provider(std::string_view ident, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_identifier_str_with_provider({ident.data(), ident.size()}, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::TimeZone::try_from_offset_str(std::string_view ident) { - auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_offset_str({ident.data(), ident.size()}); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::try_from_offset_str(std::string_view ident) { + auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_offset_str({ident.data(), ident.size()}); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::TimeZone::try_from_str(std::string_view ident) { - auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_str({ident.data(), ident.size()}); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::try_from_str(std::string_view ident) { + auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_str({ident.data(), ident.size()}); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::TimeZone::try_from_str_with_provider(std::string_view ident, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_str_with_provider({ident.data(), ident.size()}, - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::try_from_str_with_provider(std::string_view ident, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_TimeZone_try_from_str_with_provider({ident.data(), ident.size()}, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::string temporal_rs::TimeZone::identifier() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_TimeZone_identifier(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_TimeZone_identifier(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::TimeZone::identifier_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_TimeZone_identifier(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_TimeZone_identifier(this->AsFFI(), + &write); } -inline diplomat::result temporal_rs::TimeZone::identifier_with_provider(const temporal_rs::Provider& p) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_TimeZone_identifier_with_provider(this->AsFFI(), - p.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::identifier_with_provider(const temporal_rs::Provider& p) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_TimeZone_identifier_with_provider(this->AsFFI(), + p.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::TimeZone::identifier_with_provider_write(const temporal_rs::Provider& p, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_TimeZone_identifier_with_provider(this->AsFFI(), - p.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::identifier_with_provider_write(const temporal_rs::Provider& p, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_TimeZone_identifier_with_provider(this->AsFFI(), + p.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline temporal_rs::TimeZone temporal_rs::TimeZone::utc() { - auto result = temporal_rs::capi::temporal_rs_TimeZone_utc(); - return temporal_rs::TimeZone::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_TimeZone_utc(); + return temporal_rs::TimeZone::FromFFI(result); } -inline diplomat::result temporal_rs::TimeZone::utc_with_provider(const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_TimeZone_utc_with_provider(p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::utc_with_provider(const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_TimeZone_utc_with_provider(p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline temporal_rs::TimeZone temporal_rs::TimeZone::zero() { - auto result = temporal_rs::capi::temporal_rs_TimeZone_zero(); - return temporal_rs::TimeZone::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_TimeZone_zero(); + return temporal_rs::TimeZone::FromFFI(result); } -inline diplomat::result temporal_rs::TimeZone::primary_identifier() const { - auto result = temporal_rs::capi::temporal_rs_TimeZone_primary_identifier(this->AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::primary_identifier() const { + auto result = temporal_rs::capi::temporal_rs_TimeZone_primary_identifier(this->AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::TimeZone::primary_identifier_with_provider(const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_TimeZone_primary_identifier_with_provider(this->AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::TimeZone::primary_identifier_with_provider(const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_TimeZone_primary_identifier_with_provider(this->AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(temporal_rs::TimeZone::FromFFI(result.ok))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline temporal_rs::capi::TimeZone temporal_rs::TimeZone::AsFFI() const { - return temporal_rs::capi::TimeZone { - /* .offset_minutes = */ offset_minutes, - /* .resolved_id = */ resolved_id, - /* .normalized_id = */ normalized_id, - /* .is_iana_id = */ is_iana_id, - }; + return temporal_rs::capi::TimeZone { + /* .offset_minutes = */ offset_minutes, + /* .resolved_id = */ resolved_id, + /* .normalized_id = */ normalized_id, + /* .is_iana_id = */ is_iana_id, + }; } inline temporal_rs::TimeZone temporal_rs::TimeZone::FromFFI(temporal_rs::capi::TimeZone c_struct) { - return temporal_rs::TimeZone { - /* .offset_minutes = */ c_struct.offset_minutes, - /* .resolved_id = */ c_struct.resolved_id, - /* .normalized_id = */ c_struct.normalized_id, - /* .is_iana_id = */ c_struct.is_iana_id, - }; + return temporal_rs::TimeZone { + /* .offset_minutes = */ c_struct.offset_minutes, + /* .resolved_id = */ c_struct.resolved_id, + /* .normalized_id = */ c_struct.normalized_id, + /* .is_iana_id = */ c_struct.is_iana_id, + }; } -#endif // temporal_rs_TimeZone_HPP +#endif // TEMPORAL_RS_TimeZone_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.d.hpp index 31e0b871d..0b39d4661 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ToStringRoundingOptions_D_HPP -#define temporal_rs_ToStringRoundingOptions_D_HPP +#ifndef TEMPORAL_RS_ToStringRoundingOptions_D_HPP +#define TEMPORAL_RS_ToStringRoundingOptions_D_HPP #include #include @@ -9,16 +9,16 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "Precision.d.hpp" #include "RoundingMode.d.hpp" #include "Unit.d.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { struct Precision; class RoundingMode; class Unit; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -36,13 +36,13 @@ namespace capi { namespace temporal_rs { struct ToStringRoundingOptions { - temporal_rs::Precision precision; - std::optional smallest_unit; - std::optional rounding_mode; + temporal_rs::Precision precision; + std::optional smallest_unit; + std::optional rounding_mode; - inline temporal_rs::capi::ToStringRoundingOptions AsFFI() const; - inline static temporal_rs::ToStringRoundingOptions FromFFI(temporal_rs::capi::ToStringRoundingOptions c_struct); + inline temporal_rs::capi::ToStringRoundingOptions AsFFI() const; + inline static temporal_rs::ToStringRoundingOptions FromFFI(temporal_rs::capi::ToStringRoundingOptions c_struct); }; } // namespace -#endif // temporal_rs_ToStringRoundingOptions_D_HPP +#endif // TEMPORAL_RS_ToStringRoundingOptions_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.hpp b/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.hpp index 031419239..e34ebefb8 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ToStringRoundingOptions.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ToStringRoundingOptions_HPP -#define temporal_rs_ToStringRoundingOptions_HPP +#ifndef TEMPORAL_RS_ToStringRoundingOptions_HPP +#define TEMPORAL_RS_ToStringRoundingOptions_HPP #include "ToStringRoundingOptions.d.hpp" @@ -11,10 +11,10 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "Precision.hpp" #include "RoundingMode.hpp" #include "Unit.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -27,20 +27,20 @@ namespace capi { inline temporal_rs::capi::ToStringRoundingOptions temporal_rs::ToStringRoundingOptions::AsFFI() const { - return temporal_rs::capi::ToStringRoundingOptions { - /* .precision = */ precision.AsFFI(), - /* .smallest_unit = */ smallest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { smallest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), - /* .rounding_mode = */ rounding_mode.has_value() ? (temporal_rs::capi::RoundingMode_option{ { rounding_mode.value().AsFFI() }, true }) : (temporal_rs::capi::RoundingMode_option{ {}, false }), - }; + return temporal_rs::capi::ToStringRoundingOptions { + /* .precision = */ precision.AsFFI(), + /* .smallest_unit = */ smallest_unit.has_value() ? (temporal_rs::capi::Unit_option{ { smallest_unit.value().AsFFI() }, true }) : (temporal_rs::capi::Unit_option{ {}, false }), + /* .rounding_mode = */ rounding_mode.has_value() ? (temporal_rs::capi::RoundingMode_option{ { rounding_mode.value().AsFFI() }, true }) : (temporal_rs::capi::RoundingMode_option{ {}, false }), + }; } inline temporal_rs::ToStringRoundingOptions temporal_rs::ToStringRoundingOptions::FromFFI(temporal_rs::capi::ToStringRoundingOptions c_struct) { - return temporal_rs::ToStringRoundingOptions { - /* .precision = */ temporal_rs::Precision::FromFFI(c_struct.precision), - /* .smallest_unit = */ c_struct.smallest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.smallest_unit.ok)) : std::nullopt, - /* .rounding_mode = */ c_struct.rounding_mode.is_ok ? std::optional(temporal_rs::RoundingMode::FromFFI(c_struct.rounding_mode.ok)) : std::nullopt, - }; + return temporal_rs::ToStringRoundingOptions { + /* .precision = */ temporal_rs::Precision::FromFFI(c_struct.precision), + /* .smallest_unit = */ c_struct.smallest_unit.is_ok ? std::optional(temporal_rs::Unit::FromFFI(c_struct.smallest_unit.ok)) : std::nullopt, + /* .rounding_mode = */ c_struct.rounding_mode.is_ok ? std::optional(temporal_rs::RoundingMode::FromFFI(c_struct.rounding_mode.ok)) : std::nullopt, + }; } -#endif // temporal_rs_ToStringRoundingOptions_HPP +#endif // TEMPORAL_RS_ToStringRoundingOptions_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.d.hpp index a8e9b1ef1..73a2be2a1 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_TransitionDirection_D_HPP -#define temporal_rs_TransitionDirection_D_HPP +#ifndef TEMPORAL_RS_TransitionDirection_D_HPP +#define TEMPORAL_RS_TransitionDirection_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -26,24 +26,24 @@ namespace capi { namespace temporal_rs { class TransitionDirection { public: - enum Value { - Next = 0, - Previous = 1, - }; + enum Value { + Next = 0, + Previous = 1, + }; - TransitionDirection(): value(Value::Next) {} + TransitionDirection(): value(Value::Next) {} - // Implicit conversions between enum and ::Value - constexpr TransitionDirection(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; + // Implicit conversions between enum and ::Value + constexpr TransitionDirection(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; - inline temporal_rs::capi::TransitionDirection AsFFI() const; - inline static temporal_rs::TransitionDirection FromFFI(temporal_rs::capi::TransitionDirection c_enum); + inline temporal_rs::capi::TransitionDirection AsFFI() const; + inline static temporal_rs::TransitionDirection FromFFI(temporal_rs::capi::TransitionDirection c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_TransitionDirection_D_HPP +#endif // TEMPORAL_RS_TransitionDirection_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.hpp b/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.hpp index 9eb56e1ad..124167235 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/TransitionDirection.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_TransitionDirection_HPP -#define temporal_rs_TransitionDirection_HPP +#ifndef TEMPORAL_RS_TransitionDirection_HPP +#define TEMPORAL_RS_TransitionDirection_HPP #include "TransitionDirection.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,16 +23,16 @@ namespace capi { } // namespace inline temporal_rs::capi::TransitionDirection temporal_rs::TransitionDirection::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::TransitionDirection temporal_rs::TransitionDirection::FromFFI(temporal_rs::capi::TransitionDirection c_enum) { - switch (c_enum) { - case temporal_rs::capi::TransitionDirection_Next: - case temporal_rs::capi::TransitionDirection_Previous: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::TransitionDirection_Next: + case temporal_rs::capi::TransitionDirection_Previous: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_TransitionDirection_HPP +#endif // TEMPORAL_RS_TransitionDirection_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Unit.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/Unit.d.hpp index 02e024970..68cd11551 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Unit.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Unit.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Unit_D_HPP -#define temporal_rs_Unit_D_HPP +#ifndef TEMPORAL_RS_Unit_D_HPP +#define TEMPORAL_RS_Unit_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -35,33 +35,33 @@ namespace capi { namespace temporal_rs { class Unit { public: - enum Value { - Auto = 0, - Nanosecond = 1, - Microsecond = 2, - Millisecond = 3, - Second = 4, - Minute = 5, - Hour = 6, - Day = 7, - Week = 8, - Month = 9, - Year = 10, - }; + enum Value { + Auto = 0, + Nanosecond = 1, + Microsecond = 2, + Millisecond = 3, + Second = 4, + Minute = 5, + Hour = 6, + Day = 7, + Week = 8, + Month = 9, + Year = 10, + }; - Unit(): value(Value::Auto) {} + Unit(): value(Value::Auto) {} - // Implicit conversions between enum and ::Value - constexpr Unit(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; + // Implicit conversions between enum and ::Value + constexpr Unit(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; - inline temporal_rs::capi::Unit AsFFI() const; - inline static temporal_rs::Unit FromFFI(temporal_rs::capi::Unit c_enum); + inline temporal_rs::capi::Unit AsFFI() const; + inline static temporal_rs::Unit FromFFI(temporal_rs::capi::Unit c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_Unit_D_HPP +#endif // TEMPORAL_RS_Unit_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/Unit.hpp b/temporal_capi/bindings/cpp/temporal_rs/Unit.hpp index 42e7c18c1..6ab07392c 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/Unit.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/Unit.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_Unit_HPP -#define temporal_rs_Unit_HPP +#ifndef TEMPORAL_RS_Unit_HPP +#define TEMPORAL_RS_Unit_HPP #include "Unit.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,25 +23,25 @@ namespace capi { } // namespace inline temporal_rs::capi::Unit temporal_rs::Unit::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::Unit temporal_rs::Unit::FromFFI(temporal_rs::capi::Unit c_enum) { - switch (c_enum) { - case temporal_rs::capi::Unit_Auto: - case temporal_rs::capi::Unit_Nanosecond: - case temporal_rs::capi::Unit_Microsecond: - case temporal_rs::capi::Unit_Millisecond: - case temporal_rs::capi::Unit_Second: - case temporal_rs::capi::Unit_Minute: - case temporal_rs::capi::Unit_Hour: - case temporal_rs::capi::Unit_Day: - case temporal_rs::capi::Unit_Week: - case temporal_rs::capi::Unit_Month: - case temporal_rs::capi::Unit_Year: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::Unit_Auto: + case temporal_rs::capi::Unit_Nanosecond: + case temporal_rs::capi::Unit_Microsecond: + case temporal_rs::capi::Unit_Millisecond: + case temporal_rs::capi::Unit_Second: + case temporal_rs::capi::Unit_Minute: + case temporal_rs::capi::Unit_Hour: + case temporal_rs::capi::Unit_Day: + case temporal_rs::capi::Unit_Week: + case temporal_rs::capi::Unit_Month: + case temporal_rs::capi::Unit_Year: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_Unit_HPP +#endif // TEMPORAL_RS_Unit_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.d.hpp index aeb296068..b6e3d1a54 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_UnsignedRoundingMode_D_HPP -#define temporal_rs_UnsignedRoundingMode_D_HPP +#ifndef TEMPORAL_RS_UnsignedRoundingMode_D_HPP +#define TEMPORAL_RS_UnsignedRoundingMode_D_HPP #include #include @@ -9,7 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -29,27 +29,27 @@ namespace capi { namespace temporal_rs { class UnsignedRoundingMode { public: - enum Value { - Infinity = 0, - Zero = 1, - HalfInfinity = 2, - HalfZero = 3, - HalfEven = 4, - }; - - UnsignedRoundingMode(): value(Value::Infinity) {} - - // Implicit conversions between enum and ::Value - constexpr UnsignedRoundingMode(Value v) : value(v) {} - constexpr operator Value() const { return value; } - // Prevent usage as boolean value - explicit operator bool() const = delete; - - inline temporal_rs::capi::UnsignedRoundingMode AsFFI() const; - inline static temporal_rs::UnsignedRoundingMode FromFFI(temporal_rs::capi::UnsignedRoundingMode c_enum); + enum Value { + Infinity = 0, + Zero = 1, + HalfInfinity = 2, + HalfZero = 3, + HalfEven = 4, + }; + + UnsignedRoundingMode(): value(Value::Infinity) {} + + // Implicit conversions between enum and ::Value + constexpr UnsignedRoundingMode(Value v) : value(v) {} + constexpr operator Value() const { return value; } + // Prevent usage as boolean value + explicit operator bool() const = delete; + + inline temporal_rs::capi::UnsignedRoundingMode AsFFI() const; + inline static temporal_rs::UnsignedRoundingMode FromFFI(temporal_rs::capi::UnsignedRoundingMode c_enum); private: Value value; }; } // namespace -#endif // temporal_rs_UnsignedRoundingMode_D_HPP +#endif // TEMPORAL_RS_UnsignedRoundingMode_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.hpp b/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.hpp index 2ecc4c756..52f543b73 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/UnsignedRoundingMode.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_UnsignedRoundingMode_HPP -#define temporal_rs_UnsignedRoundingMode_HPP +#ifndef TEMPORAL_RS_UnsignedRoundingMode_HPP +#define TEMPORAL_RS_UnsignedRoundingMode_HPP #include "UnsignedRoundingMode.d.hpp" @@ -11,7 +11,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -23,19 +23,19 @@ namespace capi { } // namespace inline temporal_rs::capi::UnsignedRoundingMode temporal_rs::UnsignedRoundingMode::AsFFI() const { - return static_cast(value); + return static_cast(value); } inline temporal_rs::UnsignedRoundingMode temporal_rs::UnsignedRoundingMode::FromFFI(temporal_rs::capi::UnsignedRoundingMode c_enum) { - switch (c_enum) { - case temporal_rs::capi::UnsignedRoundingMode_Infinity: - case temporal_rs::capi::UnsignedRoundingMode_Zero: - case temporal_rs::capi::UnsignedRoundingMode_HalfInfinity: - case temporal_rs::capi::UnsignedRoundingMode_HalfZero: - case temporal_rs::capi::UnsignedRoundingMode_HalfEven: - return static_cast(c_enum); - default: - std::abort(); - } + switch (c_enum) { + case temporal_rs::capi::UnsignedRoundingMode_Infinity: + case temporal_rs::capi::UnsignedRoundingMode_Zero: + case temporal_rs::capi::UnsignedRoundingMode_HalfInfinity: + case temporal_rs::capi::UnsignedRoundingMode_HalfZero: + case temporal_rs::capi::UnsignedRoundingMode_HalfEven: + return static_cast(c_enum); + default: + std::abort(); + } } -#endif // temporal_rs_UnsignedRoundingMode_HPP +#endif // TEMPORAL_RS_UnsignedRoundingMode_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.d.hpp b/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.d.hpp index 2416009f3..5203612ee 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.d.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.d.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ZonedDateTime_D_HPP -#define temporal_rs_ZonedDateTime_D_HPP +#ifndef TEMPORAL_RS_ZonedDateTime_D_HPP +#define TEMPORAL_RS_ZonedDateTime_D_HPP #include #include @@ -9,8 +9,7 @@ #include #include #include -#include "../diplomat_runtime.hpp" - +#include "diplomat_runtime.hpp" namespace temporal_rs { namespace capi { struct Calendar; } class Calendar; @@ -45,7 +44,8 @@ class DisplayOffset; class DisplayTimeZone; class OffsetDisambiguation; class TransitionDirection; -} +} // namespace temporal_rs + namespace temporal_rs { @@ -58,31 +58,31 @@ namespace temporal_rs { class ZonedDateTime { public: - inline static diplomat::result, temporal_rs::TemporalError> try_new(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone); - inline static diplomat::result, temporal_rs::TemporalError> try_new_with_provider(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> try_new_with_provider(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p); - inline static diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option); - inline static diplomat::result, temporal_rs::TemporalError> from_partial_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_partial_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option, const temporal_rs::Provider& p); - inline static diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_parsed(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option); - inline static diplomat::result, temporal_rs::TemporalError> from_parsed_with_provider(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_parsed_with_provider(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option, const temporal_rs::Provider& p); - inline static diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation); - inline static diplomat::result, temporal_rs::TemporalError> from_utf8_with_provider(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf8_with_provider(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation); - inline static diplomat::result, temporal_rs::TemporalError> from_utf16_with_provider(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_utf16_with_provider(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p); inline int64_t epoch_milliseconds() const; - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz); - inline static diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); + inline static temporal_rs::diplomat::result, temporal_rs::TemporalError> from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p); inline temporal_rs::I128Nanoseconds epoch_nanoseconds() const; @@ -90,13 +90,13 @@ class ZonedDateTime { inline std::unique_ptr to_instant() const; - inline diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> with_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow, const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> with_timezone(temporal_rs::TimeZone zone) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with_timezone(temporal_rs::TimeZone zone) const; - inline diplomat::result, temporal_rs::TemporalError> with_timezone_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with_timezone_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const; inline temporal_rs::TimeZone timezone() const; @@ -104,23 +104,23 @@ class ZonedDateTime { inline bool equals(const temporal_rs::ZonedDateTime& other) const; - inline diplomat::result equals_with_provider(const temporal_rs::ZonedDateTime& other, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result equals_with_provider(const temporal_rs::ZonedDateTime& other, const temporal_rs::Provider& p) const; - inline diplomat::result offset() const; + inline temporal_rs::diplomat::result offset() const; template - inline diplomat::result offset_write(W& writeable_output) const; + inline temporal_rs::diplomat::result offset_write(W& writeable_output) const; - inline diplomat::result, temporal_rs::TemporalError> start_of_day() const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> start_of_day() const; - inline diplomat::result, temporal_rs::TemporalError> start_of_day_with_provider(const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> start_of_day_with_provider(const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> get_time_zone_transition(temporal_rs::TransitionDirection direction) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> get_time_zone_transition(temporal_rs::TransitionDirection direction) const; - inline diplomat::result, temporal_rs::TemporalError> get_time_zone_transition_with_provider(temporal_rs::TransitionDirection direction, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> get_time_zone_transition_with_provider(temporal_rs::TransitionDirection direction, const temporal_rs::Provider& p) const; - inline diplomat::result hours_in_day() const; + inline temporal_rs::diplomat::result hours_in_day() const; - inline diplomat::result hours_in_day_with_provider(const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result hours_in_day_with_provider(const temporal_rs::Provider& p) const; inline std::unique_ptr to_plain_datetime() const; @@ -128,39 +128,39 @@ class ZonedDateTime { inline std::unique_ptr to_plain_time() const; - inline diplomat::result to_ixdtf_string(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options) const; + inline temporal_rs::diplomat::result to_ixdtf_string(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options) const; template - inline diplomat::result to_ixdtf_string_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; + inline temporal_rs::diplomat::result to_ixdtf_string_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, W& writeable_output) const; - inline diplomat::result to_ixdtf_string_with_provider(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result to_ixdtf_string_with_provider(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const; template - inline diplomat::result to_ixdtf_string_with_provider_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable_output) const; + inline temporal_rs::diplomat::result to_ixdtf_string_with_provider_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable_output) const; inline std::unique_ptr with_calendar(temporal_rs::AnyCalendarKind calendar) const; - inline diplomat::result, temporal_rs::TemporalError> with_plain_time(const temporal_rs::PlainTime* time) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with_plain_time(const temporal_rs::PlainTime* time) const; - inline diplomat::result, temporal_rs::TemporalError> with_plain_time_and_provider(const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> with_plain_time_and_provider(const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add(const temporal_rs::Duration& duration, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> add_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> add_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, std::optional overflow) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract(const temporal_rs::Duration& duration, std::optional overflow) const; - inline diplomat::result, temporal_rs::TemporalError> subtract_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> subtract_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> until_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> until_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const; - inline diplomat::result, temporal_rs::TemporalError> since_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> since_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const; - inline diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round(temporal_rs::RoundingOptions options) const; - inline diplomat::result, temporal_rs::TemporalError> round_with_provider(temporal_rs::RoundingOptions options, const temporal_rs::Provider& p) const; + inline temporal_rs::diplomat::result, temporal_rs::TemporalError> round_with_provider(temporal_rs::RoundingOptions options, const temporal_rs::Provider& p) const; inline uint8_t hour() const; @@ -212,19 +212,19 @@ class ZonedDateTime { inline std::unique_ptr clone() const; - inline const temporal_rs::capi::ZonedDateTime* AsFFI() const; - inline temporal_rs::capi::ZonedDateTime* AsFFI(); - inline static const temporal_rs::ZonedDateTime* FromFFI(const temporal_rs::capi::ZonedDateTime* ptr); - inline static temporal_rs::ZonedDateTime* FromFFI(temporal_rs::capi::ZonedDateTime* ptr); - inline static void operator delete(void* ptr); + inline const temporal_rs::capi::ZonedDateTime* AsFFI() const; + inline temporal_rs::capi::ZonedDateTime* AsFFI(); + inline static const temporal_rs::ZonedDateTime* FromFFI(const temporal_rs::capi::ZonedDateTime* ptr); + inline static temporal_rs::ZonedDateTime* FromFFI(temporal_rs::capi::ZonedDateTime* ptr); + inline static void operator delete(void* ptr); private: - ZonedDateTime() = delete; - ZonedDateTime(const temporal_rs::ZonedDateTime&) = delete; - ZonedDateTime(temporal_rs::ZonedDateTime&&) noexcept = delete; - ZonedDateTime operator=(const temporal_rs::ZonedDateTime&) = delete; - ZonedDateTime operator=(temporal_rs::ZonedDateTime&&) noexcept = delete; - static void operator delete[](void*, size_t) = delete; + ZonedDateTime() = delete; + ZonedDateTime(const temporal_rs::ZonedDateTime&) = delete; + ZonedDateTime(temporal_rs::ZonedDateTime&&) noexcept = delete; + ZonedDateTime operator=(const temporal_rs::ZonedDateTime&) = delete; + ZonedDateTime operator=(temporal_rs::ZonedDateTime&&) noexcept = delete; + static void operator delete[](void*, size_t) = delete; }; } // namespace -#endif // temporal_rs_ZonedDateTime_D_HPP +#endif // TEMPORAL_RS_ZonedDateTime_D_HPP diff --git a/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.hpp b/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.hpp index e54c455ea..a4c3f6023 100644 --- a/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/ZonedDateTime.hpp @@ -1,5 +1,5 @@ -#ifndef temporal_rs_ZonedDateTime_HPP -#define temporal_rs_ZonedDateTime_HPP +#ifndef TEMPORAL_RS_ZonedDateTime_HPP +#define TEMPORAL_RS_ZonedDateTime_HPP #include "ZonedDateTime.d.hpp" @@ -11,7 +11,6 @@ #include #include #include -#include "../diplomat_runtime.hpp" #include "AnyCalendarKind.hpp" #include "ArithmeticOverflow.hpp" #include "Calendar.hpp" @@ -35,6 +34,7 @@ #include "TimeZone.hpp" #include "ToStringRoundingOptions.hpp" #include "TransitionDirection.hpp" +#include "diplomat_runtime.hpp" namespace temporal_rs { @@ -60,16 +60,16 @@ namespace capi { temporal_rs_ZonedDateTime_from_parsed_with_provider_result temporal_rs_ZonedDateTime_from_parsed_with_provider(const temporal_rs::capi::ParsedZonedDateTime* parsed, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_option, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_ZonedDateTime_from_utf8_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_from_utf8_result; - temporal_rs_ZonedDateTime_from_utf8_result temporal_rs_ZonedDateTime_from_utf8(diplomat::capi::DiplomatStringView s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation); + temporal_rs_ZonedDateTime_from_utf8_result temporal_rs_ZonedDateTime_from_utf8(temporal_rs::diplomat::capi::DiplomatStringView s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation); typedef struct temporal_rs_ZonedDateTime_from_utf8_with_provider_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_from_utf8_with_provider_result; - temporal_rs_ZonedDateTime_from_utf8_with_provider_result temporal_rs_ZonedDateTime_from_utf8_with_provider(diplomat::capi::DiplomatStringView s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation, const temporal_rs::capi::Provider* p); + temporal_rs_ZonedDateTime_from_utf8_with_provider_result temporal_rs_ZonedDateTime_from_utf8_with_provider(temporal_rs::diplomat::capi::DiplomatStringView s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_ZonedDateTime_from_utf16_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_from_utf16_result; - temporal_rs_ZonedDateTime_from_utf16_result temporal_rs_ZonedDateTime_from_utf16(diplomat::capi::DiplomatString16View s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation); + temporal_rs_ZonedDateTime_from_utf16_result temporal_rs_ZonedDateTime_from_utf16(temporal_rs::diplomat::capi::DiplomatString16View s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation); typedef struct temporal_rs_ZonedDateTime_from_utf16_with_provider_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_from_utf16_with_provider_result; - temporal_rs_ZonedDateTime_from_utf16_with_provider_result temporal_rs_ZonedDateTime_from_utf16_with_provider(diplomat::capi::DiplomatString16View s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation, const temporal_rs::capi::Provider* p); + temporal_rs_ZonedDateTime_from_utf16_with_provider_result temporal_rs_ZonedDateTime_from_utf16_with_provider(temporal_rs::diplomat::capi::DiplomatString16View s, temporal_rs::capi::Disambiguation disambiguation, temporal_rs::capi::OffsetDisambiguation offset_disambiguation, const temporal_rs::capi::Provider* p); int64_t temporal_rs_ZonedDateTime_epoch_milliseconds(const temporal_rs::capi::ZonedDateTime* self); @@ -107,7 +107,7 @@ namespace capi { temporal_rs_ZonedDateTime_equals_with_provider_result temporal_rs_ZonedDateTime_equals_with_provider(const temporal_rs::capi::ZonedDateTime* self, const temporal_rs::capi::ZonedDateTime* other, const temporal_rs::capi::Provider* p); typedef struct temporal_rs_ZonedDateTime_offset_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_offset_result; - temporal_rs_ZonedDateTime_offset_result temporal_rs_ZonedDateTime_offset(const temporal_rs::capi::ZonedDateTime* self, diplomat::capi::DiplomatWrite* write); + temporal_rs_ZonedDateTime_offset_result temporal_rs_ZonedDateTime_offset(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_ZonedDateTime_start_of_day_result {union {temporal_rs::capi::ZonedDateTime* ok; temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_start_of_day_result; temporal_rs_ZonedDateTime_start_of_day_result temporal_rs_ZonedDateTime_start_of_day(const temporal_rs::capi::ZonedDateTime* self); @@ -134,10 +134,10 @@ namespace capi { temporal_rs::capi::PlainTime* temporal_rs_ZonedDateTime_to_plain_time(const temporal_rs::capi::ZonedDateTime* self); typedef struct temporal_rs_ZonedDateTime_to_ixdtf_string_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_to_ixdtf_string_result; - temporal_rs_ZonedDateTime_to_ixdtf_string_result temporal_rs_ZonedDateTime_to_ixdtf_string(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::capi::DisplayOffset display_offset, temporal_rs::capi::DisplayTimeZone display_timezone, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::capi::ToStringRoundingOptions options, diplomat::capi::DiplomatWrite* write); + temporal_rs_ZonedDateTime_to_ixdtf_string_result temporal_rs_ZonedDateTime_to_ixdtf_string(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::capi::DisplayOffset display_offset, temporal_rs::capi::DisplayTimeZone display_timezone, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::capi::ToStringRoundingOptions options, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider_result {union { temporal_rs::capi::TemporalError err;}; bool is_ok;} temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider_result; - temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider_result temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::capi::DisplayOffset display_offset, temporal_rs::capi::DisplayTimeZone display_timezone, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::capi::ToStringRoundingOptions options, const temporal_rs::capi::Provider* p, diplomat::capi::DiplomatWrite* write); + temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider_result temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::capi::DisplayOffset display_offset, temporal_rs::capi::DisplayTimeZone display_timezone, temporal_rs::capi::DisplayCalendar display_calendar, temporal_rs::capi::ToStringRoundingOptions options, const temporal_rs::capi::Provider* p, temporal_rs::diplomat::capi::DiplomatWrite* write); temporal_rs::capi::ZonedDateTime* temporal_rs_ZonedDateTime_with_calendar(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::capi::AnyCalendarKind calendar); @@ -195,7 +195,7 @@ namespace capi { uint8_t temporal_rs_ZonedDateTime_month(const temporal_rs::capi::ZonedDateTime* self); - void temporal_rs_ZonedDateTime_month_code(const temporal_rs::capi::ZonedDateTime* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_ZonedDateTime_month_code(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::diplomat::capi::DiplomatWrite* write); uint8_t temporal_rs_ZonedDateTime_day(const temporal_rs::capi::ZonedDateTime* self); @@ -219,7 +219,7 @@ namespace capi { bool temporal_rs_ZonedDateTime_in_leap_year(const temporal_rs::capi::ZonedDateTime* self); - void temporal_rs_ZonedDateTime_era(const temporal_rs::capi::ZonedDateTime* self, diplomat::capi::DiplomatWrite* write); + void temporal_rs_ZonedDateTime_era(const temporal_rs::capi::ZonedDateTime* self, temporal_rs::diplomat::capi::DiplomatWrite* write); typedef struct temporal_rs_ZonedDateTime_era_year_result {union {int32_t ok; }; bool is_ok;} temporal_rs_ZonedDateTime_era_year_result; temporal_rs_ZonedDateTime_era_year_result temporal_rs_ZonedDateTime_era_year(const temporal_rs::capi::ZonedDateTime* self); @@ -232,529 +232,529 @@ namespace capi { } // namespace capi } // namespace -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::try_new(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_try_new(nanosecond.AsFFI(), - calendar.AsFFI(), - time_zone.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::try_new(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_try_new(nanosecond.AsFFI(), + calendar.AsFFI(), + time_zone.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::try_new_with_provider(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_try_new_with_provider(nanosecond.AsFFI(), - calendar.AsFFI(), - time_zone.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::try_new_with_provider(temporal_rs::I128Nanoseconds nanosecond, temporal_rs::AnyCalendarKind calendar, temporal_rs::TimeZone time_zone, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_try_new_with_provider(nanosecond.AsFFI(), + calendar.AsFFI(), + time_zone.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_partial(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_partial(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), - disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), - offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_partial(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_partial(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), + disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), + offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_partial_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_partial_with_provider(partial.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), - disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), - offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false }), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_partial_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional overflow, std::optional disambiguation, std::optional offset_option, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_partial_with_provider(partial.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), + disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), + offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false }), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_parsed(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_parsed(parsed.AsFFI(), - disambiguation.AsFFI(), - offset_option.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_parsed(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_parsed(parsed.AsFFI(), + disambiguation.AsFFI(), + offset_option.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_parsed_with_provider(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_parsed_with_provider(parsed.AsFFI(), - disambiguation.AsFFI(), - offset_option.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_parsed_with_provider(const temporal_rs::ParsedZonedDateTime& parsed, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_option, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_parsed_with_provider(parsed.AsFFI(), + disambiguation.AsFFI(), + offset_option.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf8(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf8({s.data(), s.size()}, - disambiguation.AsFFI(), - offset_disambiguation.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf8(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf8({s.data(), s.size()}, + disambiguation.AsFFI(), + offset_disambiguation.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf8_with_provider(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf8_with_provider({s.data(), s.size()}, - disambiguation.AsFFI(), - offset_disambiguation.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf8_with_provider(std::string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf8_with_provider({s.data(), s.size()}, + disambiguation.AsFFI(), + offset_disambiguation.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf16(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf16({s.data(), s.size()}, - disambiguation.AsFFI(), - offset_disambiguation.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf16(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf16({s.data(), s.size()}, + disambiguation.AsFFI(), + offset_disambiguation.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf16_with_provider(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf16_with_provider({s.data(), s.size()}, - disambiguation.AsFFI(), - offset_disambiguation.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_utf16_with_provider(std::u16string_view s, temporal_rs::Disambiguation disambiguation, temporal_rs::OffsetDisambiguation offset_disambiguation, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_utf16_with_provider({s.data(), s.size()}, + disambiguation.AsFFI(), + offset_disambiguation.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline int64_t temporal_rs::ZonedDateTime::epoch_milliseconds() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_epoch_milliseconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_epoch_milliseconds(this->AsFFI()); + return result; } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_epoch_milliseconds(ms, - tz.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_epoch_milliseconds(int64_t ms, temporal_rs::TimeZone tz) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_epoch_milliseconds(ms, + tz.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_epoch_milliseconds_with_provider(ms, - tz.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::from_epoch_milliseconds_with_provider(int64_t ms, temporal_rs::TimeZone tz, const temporal_rs::Provider& p) { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_from_epoch_milliseconds_with_provider(ms, + tz.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline temporal_rs::I128Nanoseconds temporal_rs::ZonedDateTime::epoch_nanoseconds() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_epoch_nanoseconds(this->AsFFI()); - return temporal_rs::I128Nanoseconds::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_epoch_nanoseconds(this->AsFFI()); + return temporal_rs::I128Nanoseconds::FromFFI(result); } inline int64_t temporal_rs::ZonedDateTime::offset_nanoseconds() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_offset_nanoseconds(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_offset_nanoseconds(this->AsFFI()); + return result; } inline std::unique_ptr temporal_rs::ZonedDateTime::to_instant() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_instant(this->AsFFI()); - return std::unique_ptr(temporal_rs::Instant::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_instant(this->AsFFI()); + return std::unique_ptr(temporal_rs::Instant::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with(this->AsFFI(), - partial.AsFFI(), - disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), - offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false }), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with(this->AsFFI(), + partial.AsFFI(), + disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), + offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false }), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_with_provider(this->AsFFI(), - partial.AsFFI(), - disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), - offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false }), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_with_provider(temporal_rs::PartialZonedDateTime partial, std::optional disambiguation, std::optional offset_option, std::optional overflow, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_with_provider(this->AsFFI(), + partial.AsFFI(), + disambiguation.has_value() ? (temporal_rs::capi::Disambiguation_option{ { disambiguation.value().AsFFI() }, true }) : (temporal_rs::capi::Disambiguation_option{ {}, false }), + offset_option.has_value() ? (temporal_rs::capi::OffsetDisambiguation_option{ { offset_option.value().AsFFI() }, true }) : (temporal_rs::capi::OffsetDisambiguation_option{ {}, false }), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_timezone(temporal_rs::TimeZone zone) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_timezone(this->AsFFI(), - zone.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_timezone(temporal_rs::TimeZone zone) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_timezone(this->AsFFI(), + zone.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_timezone_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_timezone_with_provider(this->AsFFI(), - zone.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_timezone_with_provider(temporal_rs::TimeZone zone, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_timezone_with_provider(this->AsFFI(), + zone.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline temporal_rs::TimeZone temporal_rs::ZonedDateTime::timezone() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_timezone(this->AsFFI()); - return temporal_rs::TimeZone::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_timezone(this->AsFFI()); + return temporal_rs::TimeZone::FromFFI(result); } inline int8_t temporal_rs::ZonedDateTime::compare_instant(const temporal_rs::ZonedDateTime& other) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_compare_instant(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_compare_instant(this->AsFFI(), + other.AsFFI()); + return result; } inline bool temporal_rs::ZonedDateTime::equals(const temporal_rs::ZonedDateTime& other) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_equals(this->AsFFI(), - other.AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_equals(this->AsFFI(), + other.AsFFI()); + return result; } -inline diplomat::result temporal_rs::ZonedDateTime::equals_with_provider(const temporal_rs::ZonedDateTime& other, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_equals_with_provider(this->AsFFI(), - other.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::equals_with_provider(const temporal_rs::ZonedDateTime& other, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_equals_with_provider(this->AsFFI(), + other.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::ZonedDateTime::offset() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_offset(this->AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::offset() const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_offset(this->AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::ZonedDateTime::offset_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_offset(this->AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::offset_write(W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_offset(this->AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::start_of_day() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_start_of_day(this->AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::start_of_day() const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_start_of_day(this->AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::start_of_day_with_provider(const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_start_of_day_with_provider(this->AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::start_of_day_with_provider(const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_start_of_day_with_provider(this->AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::get_time_zone_transition(temporal_rs::TransitionDirection direction) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_get_time_zone_transition(this->AsFFI(), - direction.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::get_time_zone_transition(temporal_rs::TransitionDirection direction) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_get_time_zone_transition(this->AsFFI(), + direction.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::get_time_zone_transition_with_provider(temporal_rs::TransitionDirection direction, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_get_time_zone_transition_with_provider(this->AsFFI(), - direction.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::get_time_zone_transition_with_provider(temporal_rs::TransitionDirection direction, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_get_time_zone_transition_with_provider(this->AsFFI(), + direction.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::ZonedDateTime::hours_in_day() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_hours_in_day(this->AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::hours_in_day() const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_hours_in_day(this->AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result temporal_rs::ZonedDateTime::hours_in_day_with_provider(const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_hours_in_day_with_provider(this->AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result(diplomat::Ok(result.ok)) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::hours_in_day_with_provider(const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_hours_in_day_with_provider(this->AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(result.ok)) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::ZonedDateTime::to_plain_datetime() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_plain_datetime(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_plain_datetime(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainDateTime::FromFFI(result)); } inline std::unique_ptr temporal_rs::ZonedDateTime::to_plain_date() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_plain_date(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_plain_date(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainDate::FromFFI(result)); } inline std::unique_ptr temporal_rs::ZonedDateTime::to_plain_time() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_plain_time(this->AsFFI()); - return std::unique_ptr(temporal_rs::PlainTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_plain_time(this->AsFFI()); + return std::unique_ptr(temporal_rs::PlainTime::FromFFI(result)); } -inline diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string(this->AsFFI(), - display_offset.AsFFI(), - display_timezone.AsFFI(), - display_calendar.AsFFI(), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string(this->AsFFI(), + display_offset.AsFFI(), + display_timezone.AsFFI(), + display_calendar.AsFFI(), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string(this->AsFFI(), - display_offset.AsFFI(), - display_timezone.AsFFI(), - display_calendar.AsFFI(), - options.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); -} - -inline diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string_with_provider(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider(this->AsFFI(), - display_offset.AsFFI(), - display_timezone.AsFFI(), - display_calendar.AsFFI(), - options.AsFFI(), - p.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok(std::move(output))) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string(this->AsFFI(), + display_offset.AsFFI(), + display_timezone.AsFFI(), + display_calendar.AsFFI(), + options.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +} + +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string_with_provider(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p) const { + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider(this->AsFFI(), + display_offset.AsFFI(), + display_timezone.AsFFI(), + display_calendar.AsFFI(), + options.AsFFI(), + p.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok(std::move(output))) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } template -inline diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string_with_provider_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider(this->AsFFI(), - display_offset.AsFFI(), - display_timezone.AsFFI(), - display_calendar.AsFFI(), - options.AsFFI(), - p.AsFFI(), - &write); - return result.is_ok ? diplomat::result(diplomat::Ok()) : diplomat::result(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result temporal_rs::ZonedDateTime::to_ixdtf_string_with_provider_write(temporal_rs::DisplayOffset display_offset, temporal_rs::DisplayTimeZone display_timezone, temporal_rs::DisplayCalendar display_calendar, temporal_rs::ToStringRoundingOptions options, const temporal_rs::Provider& p, W& writeable) const { + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_to_ixdtf_string_with_provider(this->AsFFI(), + display_offset.AsFFI(), + display_timezone.AsFFI(), + display_calendar.AsFFI(), + options.AsFFI(), + p.AsFFI(), + &write); + return result.is_ok ? temporal_rs::diplomat::result(temporal_rs::diplomat::Ok()) : temporal_rs::diplomat::result(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline std::unique_ptr temporal_rs::ZonedDateTime::with_calendar(temporal_rs::AnyCalendarKind calendar) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_calendar(this->AsFFI(), - calendar.AsFFI()); - return std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_calendar(this->AsFFI(), + calendar.AsFFI()); + return std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result)); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_plain_time(const temporal_rs::PlainTime* time) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_plain_time(this->AsFFI(), - time ? time->AsFFI() : nullptr); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_plain_time(const temporal_rs::PlainTime* time) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_plain_time(this->AsFFI(), + time ? time->AsFFI() : nullptr); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_plain_time_and_provider(const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_plain_time_and_provider(this->AsFFI(), - time ? time->AsFFI() : nullptr, - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::with_plain_time_and_provider(const temporal_rs::PlainTime* time, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_with_plain_time_and_provider(this->AsFFI(), + time ? time->AsFFI() : nullptr, + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::add(const temporal_rs::Duration& duration, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_add(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::add(const temporal_rs::Duration& duration, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_add(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::add_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_add_with_provider(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::add_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_add_with_provider(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::subtract(const temporal_rs::Duration& duration, std::optional overflow) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_subtract(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::subtract(const temporal_rs::Duration& duration, std::optional overflow) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_subtract(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false })); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::subtract_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_subtract_with_provider(this->AsFFI(), - duration.AsFFI(), - overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::subtract_with_provider(const temporal_rs::Duration& duration, std::optional overflow, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_subtract_with_provider(this->AsFFI(), + duration.AsFFI(), + overflow.has_value() ? (temporal_rs::capi::ArithmeticOverflow_option{ { overflow.value().AsFFI() }, true }) : (temporal_rs::capi::ArithmeticOverflow_option{ {}, false }), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::until(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_until(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::until(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_until(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::until_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_until_with_provider(this->AsFFI(), - other.AsFFI(), - settings.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::until_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_until_with_provider(this->AsFFI(), + other.AsFFI(), + settings.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::since(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_since(this->AsFFI(), - other.AsFFI(), - settings.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::since(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_since(this->AsFFI(), + other.AsFFI(), + settings.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::since_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_since_with_provider(this->AsFFI(), - other.AsFFI(), - settings.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::since_with_provider(const temporal_rs::ZonedDateTime& other, temporal_rs::DifferenceSettings settings, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_since_with_provider(this->AsFFI(), + other.AsFFI(), + settings.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::Duration::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::round(temporal_rs::RoundingOptions options) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_round(this->AsFFI(), - options.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::round(temporal_rs::RoundingOptions options) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_round(this->AsFFI(), + options.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } -inline diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::round_with_provider(temporal_rs::RoundingOptions options, const temporal_rs::Provider& p) const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_round_with_provider(this->AsFFI(), - options.AsFFI(), - p.AsFFI()); - return result.is_ok ? diplomat::result, temporal_rs::TemporalError>(diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : diplomat::result, temporal_rs::TemporalError>(diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); +inline temporal_rs::diplomat::result, temporal_rs::TemporalError> temporal_rs::ZonedDateTime::round_with_provider(temporal_rs::RoundingOptions options, const temporal_rs::Provider& p) const { + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_round_with_provider(this->AsFFI(), + options.AsFFI(), + p.AsFFI()); + return result.is_ok ? temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Ok>(std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result.ok)))) : temporal_rs::diplomat::result, temporal_rs::TemporalError>(temporal_rs::diplomat::Err(temporal_rs::TemporalError::FromFFI(result.err))); } inline uint8_t temporal_rs::ZonedDateTime::hour() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_hour(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_hour(this->AsFFI()); + return result; } inline uint8_t temporal_rs::ZonedDateTime::minute() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_minute(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_minute(this->AsFFI()); + return result; } inline uint8_t temporal_rs::ZonedDateTime::second() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_second(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_second(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::millisecond() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_millisecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_millisecond(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::microsecond() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_microsecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_microsecond(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::nanosecond() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_nanosecond(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_nanosecond(this->AsFFI()); + return result; } inline const temporal_rs::Calendar& temporal_rs::ZonedDateTime::calendar() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_calendar(this->AsFFI()); - return *temporal_rs::Calendar::FromFFI(result); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_calendar(this->AsFFI()); + return *temporal_rs::Calendar::FromFFI(result); } inline int32_t temporal_rs::ZonedDateTime::year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_year(this->AsFFI()); + return result; } inline uint8_t temporal_rs::ZonedDateTime::month() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_month(this->AsFFI()); + return result; } inline std::string temporal_rs::ZonedDateTime::month_code() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_ZonedDateTime_month_code(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_ZonedDateTime_month_code(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::ZonedDateTime::month_code_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_ZonedDateTime_month_code(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_ZonedDateTime_month_code(this->AsFFI(), + &write); } inline uint8_t temporal_rs::ZonedDateTime::day() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_day(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_day(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::day_of_week() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_day_of_week(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_day_of_week(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::day_of_year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_day_of_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_day_of_year(this->AsFFI()); + return result; } inline std::optional temporal_rs::ZonedDateTime::week_of_year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_week_of_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_week_of_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline std::optional temporal_rs::ZonedDateTime::year_of_week() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_year_of_week(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_year_of_week(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline uint16_t temporal_rs::ZonedDateTime::days_in_week() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_days_in_week(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_days_in_week(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::days_in_month() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_days_in_month(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_days_in_month(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::days_in_year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_days_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_days_in_year(this->AsFFI()); + return result; } inline uint16_t temporal_rs::ZonedDateTime::months_in_year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_months_in_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_months_in_year(this->AsFFI()); + return result; } inline bool temporal_rs::ZonedDateTime::in_leap_year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_in_leap_year(this->AsFFI()); - return result; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_in_leap_year(this->AsFFI()); + return result; } inline std::string temporal_rs::ZonedDateTime::era() const { - std::string output; - diplomat::capi::DiplomatWrite write = diplomat::WriteFromString(output); - temporal_rs::capi::temporal_rs_ZonedDateTime_era(this->AsFFI(), - &write); - return output; + std::string output; + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteFromString(output); + temporal_rs::capi::temporal_rs_ZonedDateTime_era(this->AsFFI(), + &write); + return output; } template inline void temporal_rs::ZonedDateTime::era_write(W& writeable) const { - diplomat::capi::DiplomatWrite write = diplomat::WriteTrait::Construct(writeable); - temporal_rs::capi::temporal_rs_ZonedDateTime_era(this->AsFFI(), - &write); + temporal_rs::diplomat::capi::DiplomatWrite write = temporal_rs::diplomat::WriteTrait::Construct(writeable); + temporal_rs::capi::temporal_rs_ZonedDateTime_era(this->AsFFI(), + &write); } inline std::optional temporal_rs::ZonedDateTime::era_year() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_era_year(this->AsFFI()); - return result.is_ok ? std::optional(result.ok) : std::nullopt; + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_era_year(this->AsFFI()); + return result.is_ok ? std::optional(result.ok) : std::nullopt; } inline std::unique_ptr temporal_rs::ZonedDateTime::clone() const { - auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_clone(this->AsFFI()); - return std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result)); + auto result = temporal_rs::capi::temporal_rs_ZonedDateTime_clone(this->AsFFI()); + return std::unique_ptr(temporal_rs::ZonedDateTime::FromFFI(result)); } inline const temporal_rs::capi::ZonedDateTime* temporal_rs::ZonedDateTime::AsFFI() const { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline temporal_rs::capi::ZonedDateTime* temporal_rs::ZonedDateTime::AsFFI() { - return reinterpret_cast(this); + return reinterpret_cast(this); } inline const temporal_rs::ZonedDateTime* temporal_rs::ZonedDateTime::FromFFI(const temporal_rs::capi::ZonedDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline temporal_rs::ZonedDateTime* temporal_rs::ZonedDateTime::FromFFI(temporal_rs::capi::ZonedDateTime* ptr) { - return reinterpret_cast(ptr); + return reinterpret_cast(ptr); } inline void temporal_rs::ZonedDateTime::operator delete(void* ptr) { - temporal_rs::capi::temporal_rs_ZonedDateTime_destroy(reinterpret_cast(ptr)); + temporal_rs::capi::temporal_rs_ZonedDateTime_destroy(reinterpret_cast(ptr)); } -#endif // temporal_rs_ZonedDateTime_HPP +#endif // TEMPORAL_RS_ZonedDateTime_HPP diff --git a/temporal_capi/bindings/cpp/diplomat_runtime.hpp b/temporal_capi/bindings/cpp/temporal_rs/diplomat_runtime.hpp similarity index 74% rename from temporal_capi/bindings/cpp/diplomat_runtime.hpp rename to temporal_capi/bindings/cpp/temporal_rs/diplomat_runtime.hpp index 8cd3659f6..1273ba545 100644 --- a/temporal_capi/bindings/cpp/diplomat_runtime.hpp +++ b/temporal_capi/bindings/cpp/temporal_rs/diplomat_runtime.hpp @@ -1,5 +1,5 @@ -#ifndef DIPLOMAT_RUNTIME_CPP_H -#define DIPLOMAT_RUNTIME_CPP_H +#ifndef TEMPORAL_RS_DIPLOMAT_RUNTIME_CPP_H +#define TEMPORAL_RS_DIPLOMAT_RUNTIME_CPP_H #include #include @@ -18,6 +18,7 @@ #include #endif +namespace temporal_rs { namespace diplomat { namespace capi { @@ -126,11 +127,14 @@ template<> struct WriteTrait { template struct Ok { T inner; + + // Move constructor always allowed Ok(T&& i): inner(std::forward(i)) {} - // We don't want to expose an lvalue-capable constructor in general - // however there is no problem doing this for trivially copyable types + + // copy constructor allowed only for trivially copyable types template::value>::type> - Ok(T i): inner(i) {} + Ok(const T& i) : inner(i) {} + Ok() = default; Ok(Ok&&) noexcept = default; Ok(const Ok &) = default; @@ -138,13 +142,17 @@ template struct Ok { Ok& operator=(Ok&&) noexcept = default; }; + template struct Err { T inner; + + // Move constructor always allowed Err(T&& i): inner(std::forward(i)) {} - // We don't want to expose an lvalue-capable constructor in general - // however there is no problem doing this for trivially copyable types + + // copy constructor allowed only for trivially copyable types template::value>::type> - Err(T i): inner(i) {} + Err(const T& i) : inner(i) {} + Err() = default; Err(Err&&) noexcept = default; Err(const Err &) = default; @@ -152,11 +160,16 @@ template struct Err { Err& operator=(Err&&) noexcept = default; }; +template struct fn_traits; + template class result { -private: +protected: std::variant, Err> val; public: + template + friend struct fn_traits; + result(Ok&& v): val(std::move(v)) {} result(Err&& v): val(std::move(v)) {} result() = default; @@ -287,14 +300,43 @@ using as_ffi_t = typename as_ffi::type; template using replace_string_view_t = std::conditional_t, capi::DiplomatStringView, T>; +template +struct diplomat_c_span_convert { + using type = T; +}; + +#define MAKE_SLICE_CONVERTERS(name, c_ty) \ + template \ + struct diplomat_c_span_convert>>> { \ + using type = diplomat::capi::Diplomat##name##View; \ + }; \ + template \ + struct diplomat_c_span_convert>>> { \ + using type = diplomat::capi::Diplomat##name##ViewMut; \ + }; \ + +MAKE_SLICE_CONVERTERS(I8, int8_t) +MAKE_SLICE_CONVERTERS(U8, uint8_t) +MAKE_SLICE_CONVERTERS(I16, int16_t) +MAKE_SLICE_CONVERTERS(U16, uint16_t) +MAKE_SLICE_CONVERTERS(I32, int32_t) +MAKE_SLICE_CONVERTERS(U32, uint32_t) +MAKE_SLICE_CONVERTERS(I64, int64_t) +MAKE_SLICE_CONVERTERS(U64, uint64_t) +MAKE_SLICE_CONVERTERS(F32, float) +MAKE_SLICE_CONVERTERS(F64, double) +MAKE_SLICE_CONVERTERS(Bool, bool) +MAKE_SLICE_CONVERTERS(Char, char32_t) +MAKE_SLICE_CONVERTERS(String, char) +MAKE_SLICE_CONVERTERS(String16, char16_t) + template -using replace_ref_with_ptr_t = std::conditional_t, std::add_pointer_t>, T>; +using diplomat_c_span_convert_t = typename diplomat_c_span_convert::type; /// Replace the argument types from the std::function with the argument types for th function pointer template -using replace_fn_t = replace_string_view_t>; +using replace_fn_t = diplomat_c_span_convert_t>>; -template struct fn_traits; template struct fn_traits> { using fn_ptr_t = Ret(Args...); using function_t = std::function; @@ -305,6 +347,8 @@ template struct fn_traits val) { if constexpr(std::is_same_v) { return std::string_view{val.data, val.len}; + } else if constexpr (!std::is_same_v>) { + return T{ val.data, val.len }; } else if constexpr (!std::is_same_v>) { if constexpr (std::is_lvalue_reference_v) { return *std::remove_reference_t::FromFFI(val); @@ -318,10 +362,83 @@ template struct fn_traits + static replace_fn_t replace_ret(T val) { + if constexpr(std::is_same_v) { + return {val.data(), val.size()}; + } else if constexpr (!std::is_same_v>) { + // Can we convert straight away to our slice type, or (in the case of ABI compatible structs), do we have to do a reinterpret cast? + if constexpr(std::is_same_v().data()), decltype(replace_fn_t::data)>) { + return replace_fn_t { val.data(), val.size() }; + } else { + return replace_fn_t { reinterpret_cast::data)>(val.data()), val.size() }; + } + } else if constexpr(!std::is_same_v>) { + return val.AsFFI(); + } else { + return val; + } + } + static Ret c_run_callback(const void *cb, replace_fn_t... args) { return (*reinterpret_cast(cb))(replace(args)...); } + template + static TOut c_run_callback_result(const void *cb, replace_fn_t... args) { + result res = c_run_callback(cb, args...); + + auto is_ok = res.is_ok(); + + constexpr bool has_ok = !std::is_same_v; + constexpr bool has_err = !std::is_same_v; + + TOut out; + out.is_ok = is_ok; + + if constexpr (has_ok) { + if (is_ok) { + out.ok = replace_ret(std::get>(res.val).inner); + } + } + + if constexpr(has_err) { + if (!is_ok) { + out.err = replace_ret(std::get>(res.val).inner); + } + } + + return out; + } + + // For DiplomatOption<> + template + static TOut c_run_callback_diplomat_option(const void *cb, replace_fn_t... args) { + constexpr bool has_ok = !std::is_same_v; + + std::optional ret = c_run_callback(cb, args...); + + bool is_ok = ret.has_value(); + + TOut out; + out.is_ok = is_ok; + + if constexpr(has_ok) { + if (is_ok) { + out.ok = replace_ret(ret.value()); + } + } + return out; + } + + // All we need to do is just convert one pointer to another, while keeping the arguments the same: + template + static T c_run_callback_diplomat_opaque(const void* cb, replace_fn_t... args) { + Ret out = c_run_callback(cb, args...); + + return out->AsFFI(); + } + static void c_delete(const void *cb) { delete reinterpret_cast(cb); } @@ -383,5 +500,5 @@ struct next_to_iter_helper { }; } // namespace diplomat - +} // namespace temporal_rs #endif \ No newline at end of file diff --git a/temporal_capi/src/calendar.rs b/temporal_capi/src/calendar.rs index f77a58fe3..5184609e5 100644 --- a/temporal_capi/src/calendar.rs +++ b/temporal_capi/src/calendar.rs @@ -1,6 +1,5 @@ #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::error::ffi::TemporalError; use alloc::boxed::Box; diff --git a/temporal_capi/src/duration.rs b/temporal_capi/src/duration.rs index e9e2fc7d2..bfa5d92eb 100644 --- a/temporal_capi/src/duration.rs +++ b/temporal_capi/src/duration.rs @@ -2,7 +2,6 @@ use crate::error::ffi::TemporalError; #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::error::ffi::TemporalError; use crate::options::ffi::ToStringRoundingOptions; diff --git a/temporal_capi/src/error.rs b/temporal_capi/src/error.rs index 779c1e374..95c632d14 100644 --- a/temporal_capi/src/error.rs +++ b/temporal_capi/src/error.rs @@ -1,6 +1,5 @@ #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use diplomat_runtime::{DiplomatOption, DiplomatUtf8StrSlice}; diff --git a/temporal_capi/src/instant.rs b/temporal_capi/src/instant.rs index 2372e1baf..e14a8b8a7 100644 --- a/temporal_capi/src/instant.rs +++ b/temporal_capi/src/instant.rs @@ -1,6 +1,5 @@ #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::duration::ffi::Duration; use crate::error::ffi::TemporalError; diff --git a/temporal_capi/src/options.rs b/temporal_capi/src/options.rs index c6f169e04..445cf1549 100644 --- a/temporal_capi/src/options.rs +++ b/temporal_capi/src/options.rs @@ -2,7 +2,6 @@ use crate::error::ffi::TemporalError; #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use diplomat_runtime::DiplomatOption; use temporal_rs::options; diff --git a/temporal_capi/src/plain_date.rs b/temporal_capi/src/plain_date.rs index 8209487cf..8d7e75724 100644 --- a/temporal_capi/src/plain_date.rs +++ b/temporal_capi/src/plain_date.rs @@ -4,7 +4,6 @@ use crate::error::ffi::TemporalError; #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::calendar::ffi::{AnyCalendarKind, Calendar}; use crate::duration::ffi::Duration; diff --git a/temporal_capi/src/plain_date_time.rs b/temporal_capi/src/plain_date_time.rs index dd4c8a7ba..fb1487de0 100644 --- a/temporal_capi/src/plain_date_time.rs +++ b/temporal_capi/src/plain_date_time.rs @@ -2,7 +2,6 @@ use crate::error::ffi::TemporalError; #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::calendar::ffi::{AnyCalendarKind, Calendar}; use crate::duration::ffi::Duration; diff --git a/temporal_capi/src/plain_month_day.rs b/temporal_capi/src/plain_month_day.rs index 87c2f36d0..fe3878ab1 100644 --- a/temporal_capi/src/plain_month_day.rs +++ b/temporal_capi/src/plain_month_day.rs @@ -1,6 +1,5 @@ #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::calendar::ffi::{AnyCalendarKind, Calendar}; use crate::error::ffi::TemporalError; diff --git a/temporal_capi/src/plain_time.rs b/temporal_capi/src/plain_time.rs index 90ebaa83c..a6dc15616 100644 --- a/temporal_capi/src/plain_time.rs +++ b/temporal_capi/src/plain_time.rs @@ -1,6 +1,5 @@ #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use alloc::boxed::Box; diff --git a/temporal_capi/src/plain_year_month.rs b/temporal_capi/src/plain_year_month.rs index 51851c616..066bbd775 100644 --- a/temporal_capi/src/plain_year_month.rs +++ b/temporal_capi/src/plain_year_month.rs @@ -1,6 +1,5 @@ #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::calendar::ffi::{AnyCalendarKind, Calendar}; use crate::duration::ffi::Duration; diff --git a/temporal_capi/src/provider.rs b/temporal_capi/src/provider.rs index fe821b10c..70b4e39ef 100644 --- a/temporal_capi/src/provider.rs +++ b/temporal_capi/src/provider.rs @@ -31,7 +31,6 @@ macro_rules! with_provider( #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use super::ProviderInner; use alloc::boxed::Box; diff --git a/temporal_capi/src/time_zone.rs b/temporal_capi/src/time_zone.rs index 7249d7886..60cb33bdf 100644 --- a/temporal_capi/src/time_zone.rs +++ b/temporal_capi/src/time_zone.rs @@ -4,7 +4,6 @@ use timezone_provider::provider::{NormalizedId, ResolvedId}; #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::error::ffi::TemporalError; use crate::provider::ffi::Provider; diff --git a/temporal_capi/src/zoned_date_time.rs b/temporal_capi/src/zoned_date_time.rs index e3da657ed..a11cede01 100644 --- a/temporal_capi/src/zoned_date_time.rs +++ b/temporal_capi/src/zoned_date_time.rs @@ -4,7 +4,6 @@ use temporal_rs::options::RelativeTo; #[diplomat::bridge] #[diplomat::abi_rename = "temporal_rs_{0}"] -#[diplomat::attr(auto, namespace = "temporal_rs")] pub mod ffi { use crate::calendar::ffi::AnyCalendarKind; use crate::calendar::ffi::Calendar; diff --git a/tools/diplomat-gen/Cargo.toml b/tools/diplomat-gen/Cargo.toml index 53196bb96..80028e3c1 100644 --- a/tools/diplomat-gen/Cargo.toml +++ b/tools/diplomat-gen/Cargo.toml @@ -11,4 +11,4 @@ exclude.workspace = true publish = false [dependencies] -diplomat-tool = "0.12.1" +diplomat-tool.workspace = true diff --git a/tools/diplomat-gen/src/main.rs b/tools/diplomat-gen/src/main.rs index 3fcc4c646..5f879b013 100644 --- a/tools/diplomat-gen/src/main.rs +++ b/tools/diplomat-gen/src/main.rs @@ -14,14 +14,18 @@ fn main() -> std::io::Result<()> { .unwrap() .join("temporal_capi"); - let library_config = Config::default(); + let mut library_config = Config::default(); + library_config.shared_config.lib_name = Some("temporal_rs".into()); for lang in LANGUAGES { diplomat_tool::gen( &capi.join("src/lib.rs"), lang, &{ - let include = capi.join("bindings").join(lang); + let mut include = capi.join("bindings").join(lang); + if lang == "cpp" { + include = include.join("temporal_rs"); + } if let Err(err) = std::fs::remove_dir_all(&include) { if err.kind() != io::ErrorKind::NotFound { return Err(err);