derive Debug for AirtableRecord

This commit is contained in:
Brent Schroeter 2025-09-16 23:17:21 -07:00
parent 7532694a92
commit eb5e2f4847
3 changed files with 15 additions and 8 deletions

View file

@ -1,3 +1,5 @@
use std::fmt::Debug;
use derive_builder::Builder; use derive_builder::Builder;
use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode}; use percent_encoding::{NON_ALPHANUMERIC, utf8_percent_encode};
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
@ -27,7 +29,7 @@ where
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]
pub struct CreateRecordsResponse<T> pub struct CreateRecordsResponse<T>
where where
T: Clone + Serialize, T: Clone + Debug + Serialize,
{ {
/// Records successfully created in Airtable. /// Records successfully created in Airtable.
pub records: Vec<AirtableRecord<T>>, pub records: Vec<AirtableRecord<T>>,
@ -47,7 +49,7 @@ pub struct CreateRecordsDetails {
impl<T> CreateRecordsQuery<T> impl<T> CreateRecordsQuery<T>
where where
T: Clone + DeserializeOwned + Serialize, T: Clone + Debug + DeserializeOwned + Serialize,
{ {
/// Execute the API request. /// Execute the API request.
/// ///

View file

@ -1,4 +1,5 @@
use std::collections::VecDeque; use std::collections::VecDeque;
use std::fmt::Debug;
use std::pin::Pin; use std::pin::Pin;
use derive_builder::Builder; use derive_builder::Builder;
@ -53,7 +54,7 @@ pub struct ListRecordsQuery {
impl<T> PaginatedQuery<AirtableRecord<T>, ListRecordsResponse<T>> for ListRecordsQuery impl<T> PaginatedQuery<AirtableRecord<T>, ListRecordsResponse<T>> for ListRecordsQuery
where where
T: Clone + DeserializeOwned, T: Clone + Debug + DeserializeOwned,
{ {
fn get_offset(&self) -> Option<String> { fn get_offset(&self) -> Option<String> {
self.offset.clone() self.offset.clone()
@ -77,7 +78,7 @@ impl ListRecordsQuery {
self, self,
) -> Pin<Box<impl Stream<Item = Result<AirtableRecord<T>, ExecutionError>>>> ) -> Pin<Box<impl Stream<Item = Result<AirtableRecord<T>, ExecutionError>>>>
where where
T: Clone + DeserializeOwned, T: Clone + Debug + DeserializeOwned,
{ {
execute_paginated::<AirtableRecord<T>, ListRecordsResponse<T>>(self) execute_paginated::<AirtableRecord<T>, ListRecordsResponse<T>>(self)
} }
@ -86,7 +87,7 @@ impl ListRecordsQuery {
#[derive(Clone, Deserialize)] #[derive(Clone, Deserialize)]
struct ListRecordsResponse<T> struct ListRecordsResponse<T>
where where
T: Clone, T: Clone + Debug,
{ {
offset: Option<String>, offset: Option<String>,
records: VecDeque<AirtableRecord<T>>, records: VecDeque<AirtableRecord<T>>,
@ -94,7 +95,7 @@ where
impl<T> PaginatedResponse<AirtableRecord<T>> for ListRecordsResponse<T> impl<T> PaginatedResponse<AirtableRecord<T>> for ListRecordsResponse<T>
where where
T: Clone + DeserializeOwned, T: Clone + Debug + DeserializeOwned,
{ {
fn get_offset(&self) -> Option<String> { fn get_offset(&self) -> Option<String> {
self.offset.clone() self.offset.clone()

View file

@ -1,11 +1,15 @@
use std::fmt::Debug;
#[cfg(feature = "chrono")] #[cfg(feature = "chrono")]
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use serde::Deserialize; use serde::Deserialize;
#[derive(Clone, Deserialize)] // TODO: Write custom implementation of `Debug` trait that allows the `T: Debug`
// bound to be removed.
#[derive(Clone, Debug, Deserialize)]
pub struct AirtableRecord<T> pub struct AirtableRecord<T>
where where
T: Clone, T: Clone + Debug,
{ {
/// Record ID. /// Record ID.
pub id: String, pub id: String,