connect2axum-codegen 0.1.0

Protoc generators for REST, WebSocket, OpenAPI, and AsyncAPI wrappers over ConnectRPC services
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::internal::ir::CommentSet;

pub fn comment_description(comments: &CommentSet) -> Option<String> {
    let lines = comments
        .leading_detached
        .iter()
        .chain(comments.leading.iter())
        .flat_map(|comment| comment.lines())
        .map(str::trim)
        .filter(|line| !line.is_empty())
        .collect::<Vec<_>>();

    if lines.is_empty() {
        None
    } else {
        Some(lines.join("\n"))
    }
}