codex-mobile-bridge 0.3.10

Remote bridge and service manager for codex-mobile.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rusqlite::types::Type;
use serde::de::DeserializeOwned;

use crate::bridge_protocol::ThreadSummary;

pub(super) fn decode_json_row<T: DeserializeOwned>(raw: String) -> rusqlite::Result<T> {
    serde_json::from_str(&raw)
        .map_err(|error| rusqlite::Error::FromSqlConversionFailure(0, Type::Text, Box::new(error)))
}

pub(super) fn decode_thread_row(raw: String, archived: i64) -> rusqlite::Result<ThreadSummary> {
    let mut thread: ThreadSummary = decode_json_row(raw)?;
    thread.archived = archived != 0;
    Ok(thread)
}