1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use serde::{Deserialize, Serialize};
use std::{any::Any, fmt};

/// A helper for arbitrary connector-specific data in SqlSchema.
#[derive(Default)]
pub(crate) struct ConnectorData {
    pub(crate) data: Option<Box<dyn Any + Send + Sync + 'static>>,
}

impl PartialEq for ConnectorData {
    fn eq(&self, _other: &Self) -> bool {
        true
    }
}

impl fmt::Debug for ConnectorData {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str("<ConnectorData>")
    }
}

impl Serialize for ConnectorData {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_unit()
    }
}

impl<'de> Deserialize<'de> for ConnectorData {
    fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        Ok(Default::default())
    }
}