bson-rust - PR #587: Add integration with `jiff::Timestamp`

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • bson-3.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Guara92 has created PR #587: Add integration with `jiff::Timestamp` in bson-rust

      Issue Text:

          1. feat: Add interoperability with `jiff::Timestamp`
            Hi!
            This PR introduces interoperability with the `jiff` ([docs](https://docs.rs/jiff/0.2.15/jiff/)) crate by adding helpers to convert between `jiff::Timestamp` and `bson::DateTime`. This allows users of `jiff`, a modern and standards-focused time library, to seamlessly serialize and deserialize timestamps with BSON, I followed the already present integration with `chrono` to add features and tests.

      *Changes included:*

      • *Optional Dependency*: Added `jiff` as an optional dependency under the `jiff-0_2` feature flag.
      • *Serde Helper*: Created a new `serde_with` helper, `datetime::FromJiff02Timestamp`, to enable ergonomic serialization for structs (e.g., `#[serde_as(as = "datetime::FromJiff02Timestamp")]`).
      • *Direct Conversions*: Added `DateTime::from_jiff()` and `DateTime::to_jiff()` for direct, manual conversions between the two types.
      • *Tests*: Added tests equivalent to the chrono ones

      Let me know if I missed anything!

              Assignee:
              Abraham Egnor
              Reporter:
              TPM Jira Automations Bot
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: