docs: Add rustdoc comments to services/types.rs structs and methods

Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-10 12:26:23 -03:00
parent 6ccea1872c
commit 56a0ba2519

View File

@@ -4,12 +4,20 @@ use std::collections::HashMap;
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ItemWithMeta { pub struct ItemWithMeta {
/// The core item data.
pub item: Item, pub item: Item,
/// Associated tags.
pub tags: Vec<Tag>, pub tags: Vec<Tag>,
/// Associated metadata.
pub meta: Vec<Meta>, pub meta: Vec<Meta>,
} }
impl ItemWithMeta { impl ItemWithMeta {
/// Converts metadata to a HashMap for easy lookup.
///
/// # Returns
///
/// `HashMap<String, String>` - Metadata as key-value pairs.
pub fn meta_as_map(&self) -> HashMap<String, String> { pub fn meta_as_map(&self) -> HashMap<String, String> {
self.meta.iter().cloned().map(|m| (m.name, m.value)).collect() self.meta.iter().cloned().map(|m| (m.name, m.value)).collect()
} }
@@ -17,6 +25,8 @@ impl ItemWithMeta {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ItemWithContent { pub struct ItemWithContent {
/// Item with associated metadata and tags.
pub item_with_meta: ItemWithMeta, pub item_with_meta: ItemWithMeta,
/// The content bytes.
pub content: Vec<u8>, pub content: Vec<u8>,
} }