MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / write_field

Method write_field

flow-plugins/src/utils/multipart.rs:76–86  ·  view source on GitHub ↗
(
        &mut self,
        name: &str,
        content_type: &Mime,
        mut contents: R,
    )

Source from the content-addressed store, hash-verified

74 }
75
76 pub fn write_field<R: std::io::Read>(
77 &mut self,
78 name: &str,
79 content_type: &Mime,
80 mut contents: R,
81 ) -> std::io::Result<&mut Self> {
82 self.write_field_header(name, content_type)?;
83 std::io::copy(&mut contents, &mut self.inner)?;
84 self.inner.write_all(b"\r\n")?;
85 Ok(self)
86 }
87
88 pub fn write_text(&mut self, name: &str, text: &str) -> std::io::Result<&mut Self> {
89 self.write_field(name, &mime::TEXT_PLAIN, text.as_bytes())

Callers 1

write_textMethod · 0.80

Calls 1

write_field_headerMethod · 0.80

Tested by

no test coverage detected