Skip to content

Commit 48583d6

Browse files
authored
[ENH]: (Rust client): improve std::fmt::Debug of ChromaCollection (#5689)
1 parent 2fcde02 commit 48583d6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

rust/chroma/src/collection.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,24 @@ use serde::{de::DeserializeOwned, Serialize};
1313

1414
use crate::{client::ChromaClientError, ChromaHttpClient};
1515

16-
#[derive(Clone, Debug)]
16+
#[derive(Clone)]
1717
pub struct ChromaCollection {
1818
pub(crate) client: ChromaHttpClient,
1919
pub(crate) collection: Arc<Collection>,
2020
}
2121

22+
impl std::fmt::Debug for ChromaCollection {
23+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24+
f.debug_struct("ChromaCollection")
25+
.field("database", &self.collection.database)
26+
.field("tenant", &self.collection.tenant)
27+
.field("name", &self.collection.name)
28+
.field("collection_id", &self.collection.collection_id)
29+
.field("version", &self.collection.version)
30+
.finish()
31+
}
32+
}
33+
2234
impl ChromaCollection {
2335
pub fn database(&self) -> &str {
2436
&self.collection.database

0 commit comments

Comments
 (0)