mirror of
https://github.com/poem-web/poem.git
synced 2026-01-25 04:18:25 +00:00
poem-mcp: Add ContentsIter wrapper for multiple contents
This commit is contained in:
@@ -44,6 +44,19 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// A wrapper type for multiple contents from an iterator.
|
||||
pub struct ContentsIter<T>(pub T);
|
||||
|
||||
impl<T> IntoContents for ContentsIter<T>
|
||||
where
|
||||
T: IntoIterator,
|
||||
T::Item: IntoContent,
|
||||
{
|
||||
fn into_contents(self) -> Vec<Content> {
|
||||
self.0.into_iter().map(IntoContent::into_content).collect()
|
||||
}
|
||||
}
|
||||
|
||||
/// A text response.
|
||||
#[derive(Debug)]
|
||||
pub struct Text<T>(pub T);
|
||||
|
||||
Reference in New Issue
Block a user