Problem: impl Iterator to return DateTime<Tz>

I need to implement the Iterator trait:

  1. whose next() returns a generic DateTime<Tz> type, but
  2. acts as a wrapper over an inner iterator in which the timestamp is stored in nanoseconds.

Remarks:

  • condition (1) is enforced by the fact that the implementer is an enum variant;
  • condition (2) is given by the fact that the inner iterator is over a polar (dataframe) struct that stores timestamps as integers;

Here is my attemp:

use chrono::{TimeZone, DateTime, NativeDateTime, Utc};
use polars::prelude::*; //  dataframe crate providing:NumericChunkIterDispatch, TimestampNanosecondType

pub struct TimestampScheduleIterator<'a, Tz: TimeZone> {
    iterator: NumericChunkIterDispatch<'a, TimestampNanosecondType>,
}
impl<'a, Tz> TimestampScheduleIterator<'a, Tz>
    where
        Tz: TimeZone,
{
impl<'a, Tz> Iterator for TimestampScheduleIterator<'a, Tz>
    where
        Tz: TimeZone,
{
    type Item = DateTime<Tz>;

    fn next(&mut self) -> Option<DateTime<Tz>> {

        // conversion helper (from `polar`'s `conversions_utils.rs`)
        fn timestamp_nanoseconds_as_datetime(v: i64) -> NaiveDateTime {
            // some nanoseconds will be truncated down as integer division rounds downwards
            let seconds = v.clone() / 1_000_000_000;
            // we can use that to compute the remaining nanoseconds
            let nanoseconds = (v - (seconds * 1_000_000_000)) as u32;
            NaiveDateTime::from_timestamp(seconds, nanoseconds)
        }

        if let Some(ns) = self.iterator.next() {
            let naive = timestamp_nanoseconds_as_datetime(ns.unwrap());
            let dt = Utc.from_utc_datetime(&naive);   
            Some(dt)
        }
        else { None }
    }
}

Compilation generates the following error:

error[E0308]: mismatched types
   --> src/accounting/event/schedule.rs:200:18
    |
168 | impl<'a, Tz> Iterator for TimestampScheduleIterator<'a, Tz>
    |          -- this type parameter
...
200 |             Some(dt)
    |                  ^^ expected type parameter `Tz`, found struct `chrono::Utc`
    |
    = note: expected struct `DateTime<Tz>`
               found struct `DateTime<chrono::Utc>`

Help much appreciated!

Was able to extract the valid offset from the previously datetime stored; this works:

...
let naive = timestamp_nanoseconds_as_datetime(ns.unwrap());
let offset = self.previous_datetime.offset().clone();
let dt = DateTime::<Tz>::from_utc(naive, offset);
Some(dt)