a2a_client/utils/mod.rs
1//! Utility functions for A2A web clients.
2//!
3//! This module provides helper functions for working with A2A protocol types
4//! in web applications. It includes formatting utilities for displaying tasks
5//! and messages in user interfaces.
6//!
7//! # Examples
8//!
9//! ```rust
10//! use a2a_client::utils::{format_task_state, format_message_content, truncate_preview};
11//! use a2a_rs::domain::{TaskState, Part};
12//!
13//! // Format a task state for display
14//! let state = TaskState::Working;
15//! assert_eq!(format_task_state(&state), "Working");
16//!
17//! // Format message parts as text
18//! let parts = vec![Part::text("Hello, world!".to_string())];
19//! let content = format_message_content(&parts);
20//! assert_eq!(content, "Hello, world!");
21//!
22//! // Truncate text for previews
23//! let preview = truncate_preview("This is a very long message", 10);
24//! assert_eq!(preview, "This is a ...");
25//! ```
26
27pub mod formatters;
28
29pub use formatters::{format_message_content, format_task_state, truncate_preview};