You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: time.rs
    path of file: ./repos/rusqlite/src/types
    
    the code of the file until where you have to start completion: //! Convert formats 1-10 in [Time Values](https://sqlite.org/lang_datefunc.html#time_values) to time types.
//! [`ToSql`] and [`FromSql`] implementation for [`time::OffsetDateTime`].
//! [`ToSql`] and [`FromSql`] implementation for [`time::PrimitiveDateTime`].
//! [`ToSql`] and [`FromSql`] implementation for [`time::Date`].
//! [`ToSql`] and [`FromSql`] implementation for [`time::Time`].
//! Time Strings in:
//!  - Format 2: "YYYY-MM-DD HH:MM"
//!  - Format 5: "YYYY-MM-DDTHH:MM"
//!  - Format 8: "HH:MM"
//! without an explicit second value will assume 0 seconds.
//! Time String that contain an optional timezone without an explicit date are unsupported.
//! All other assumptions described in [Time Values](https://sqlite.org/lang_datefunc.html#time_values) section are unsupported.

use crate::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
use crate::{Error, Result};
use time::format_description::FormatItem;
use time::macros::format_description;
use time::{Date, OffsetDateTime, PrimitiveDateTime, Time};

const OFFSET_DATE_TIME_ENCODING: &[FormatItem<'_>] = format_description!(
    version = 2,
    "[year]-[month]-[day] [hour]:[minute]:[second].[subsecond][offset_hour
    
    fn test_offset_date_time_parsing() -> Result<()> {
        let db = checked_memory_handle()?;
        let tests = vec![
            // Rfc3339
            (
                "2013-10-07T08:23:19.123456789Z",
                datetime!(2013-10-07 8:23:19.123456789 UTC),
            ),
            (
                "2013-10-07 08:23:19.123456789Z",
                datetime!(2013-10-07 8:23:19.123456789 UTC),
            ),
            // Format 2
            ("2013-10-07 08:23", datetime!(2013-10-07 8:23 UTC)),
            ("2013-10-07 08:23Z", datetime!(2013-10-07 8:23 UTC)),
            ("2013-10-07 08:23+04:00", datetime!(2013-10-07 8:23 +4)),
            // Format 3
            ("2013-10-07 08:23:19", datetime!(2013-10-07 8:23:19 UTC)),
            ("2013-10-07 08:23:19Z", datetime!(2013-10-07 8:23:19 UTC)),
            (
                "2013-10-07 08:23:19+04:00",
                datetime!(2013-10-07 8:23:19 +4),
            ),
            // Format 4
            (
                "2013-10-07 08:23:19.123",
                datetime!(2013-10-07 8:23:19.123 UTC),
            ),
            (
                "2013-10-07 08:23:19.123Z",
                datetime!(2013-10-07 8:23:19.123 UTC),
            ),
            (
                "2013-10-07 08:23:19.123+04:00",
                datetime!(2013-10-07 8:23:19.123 +4),
            ),
            // Format 5
            ("2013-10-07T08:23", datetime!(2013-10-07 8:23 UTC)),
            ("2013-10-07T08:23Z", datetime!(2013-10-07 8:23 UTC)),
            ("2013-10-07T08:23+04:00", datetime!(2013-10-07 8:23 +4)),
            // Format 6
            ("2013-10-07T08:23:19", datetime!(2013-10-07 8:23:19 UTC)),
            ("2013-10-07T08:23:19Z", datetime!(2013-10-07 8:23:19 UTC)),
            (
                "2013-10-07T08:23:19+04:00",
                datetime!(2013-10-07 8:23:19 +4),
            ),
            // Format 7
            (
                "2013-10-07T08:23:19.123",
                datetime!(2013-10-07 8:23:19.123 UTC),
            ),
            (
                "2013-10-07T08:23:19.123Z",
                datetime!(2013-10-07 8:23:19.123 UTC),
            ),
            (
                "2013-10-07T08:23:19.123+04:00",
                datetime!(2013-10-07 8:23:19.123 +4),
            ),
            // Legacy
            (
                "2013-10-07 08:23:12:987 -07:00",
                datetime!(2013-10-07 8:23:12.987 -7),
            ),
        ];

        for (s, t) in tests {
            let result: OffsetDateTime = db.query_row("SELECT ?1", [s], |r| r.get(0))?;
            assert_eq!(result, t);
        }
        Ok(())
    }