Trait `postgres::types::FromSql` is not implemented for `bit_vec::BitVec`

I have following data structure :-

#[derive(Serialize, Debug)]
pub struct TestEvent {
    id: i32,
    event_mask: bit_vec::BitVec
}

While fetching value for this field from database, I am getting error as

the trait `postgres::types::FromSql` is not implemented for `bit_vec::BitVec`

FromSql standard mentions that trait needs to be enabled for bit-vec which I enabled through :-

postgres = { version = "0.14", features = ["with-chrono", "with-bit-vec"] }
bit-vec = {version = "0.6.1", features = ["serde"]}

Still I am getting that same error.

This was cross-posted to Stack Overflow where it was marked a duplicate of Why is a trait not implemented for a type that clearly has it implemented?.

Using cargo-tree:

bit-vec v0.4.4
└── postgres-shared v0.3.0
    └── postgres v0.14.2
        └── bv v0.1.0 (/private/tmp/bv)

bit-vec v0.6.1
└── bv v0.1.0 (/private/tmp/bv)

log v0.3.9
└── postgres v0.14.2
    └── bv v0.1.0 (/private/tmp/bv)

log v0.4.6
└── log v0.3.9
    └── postgres v0.14.2
        └── bv v0.1.0 (/private/tmp/bv)

rand v0.3.23
└── postgres-protocol v0.3.2
    ├── postgres v0.14.2
    │   └── bv v0.1.0 (/private/tmp/bv)
    └── postgres-shared v0.3.0
        └── postgres v0.14.2 (*)

rand v0.4.6
└── rand v0.3.23
    └── postgres-protocol v0.3.2
        ├── postgres v0.14.2
        │   └── bv v0.1.0 (/private/tmp/bv)
        └── postgres-shared v0.3.0
            └── postgres v0.14.2 (*)

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.