nyquest_interface/body/
multipart.rs1use std::{borrow::Cow, fmt::Debug};
7
8pub struct Part<S> {
13 pub headers: Vec<(Cow<'static, str>, Cow<'static, str>)>,
15 pub name: Cow<'static, str>,
17 pub filename: Option<Cow<'static, str>>,
19 pub content_type: Cow<'static, str>,
21 pub body: PartBody<S>,
23}
24
25pub enum PartBody<S> {
29 Bytes {
31 content: Cow<'static, [u8]>,
33 },
34 Stream(S),
36}
37
38impl<S> Debug for Part<S>
39where
40 S: Debug,
41{
42 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43 f.debug_struct("Part")
44 .field("headers", &self.headers)
45 .field("name", &self.name)
46 .field("filename", &self.filename)
47 .field("content_type", &self.content_type)
48 .field("body", &self.body)
49 .finish()
50 }
51}
52
53impl<S> Debug for PartBody<S>
54where
55 S: Debug,
56{
57 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
58 match self {
59 PartBody::Bytes { content } => f
60 .debug_struct("PartBody::Bytes")
61 .field("content", content)
62 .finish(),
63 PartBody::Stream(stream) => f
64 .debug_struct("PartBody::Stream")
65 .field("stream", stream)
66 .finish(),
67 }
68 }
69}