Skip to content

Commit f703349

Browse files
committed
Impl From<include_dir::File<'static> for ResponseBody.
1 parent f8d2bff commit f703349

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/response_body.rs

+6
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ impl<const LEN: usize> From<[u8; LEN]> for ResponseBody {
142142
ResponseBody::Vec(b.to_vec())
143143
}
144144
}
145+
#[cfg(feature = "include_dir")]
146+
impl From<&'static include_dir::File<'static>> for ResponseBody {
147+
fn from(file: &'static include_dir::File<'static>) -> Self {
148+
ResponseBody::StaticBytes(file.contents())
149+
}
150+
}
145151
impl PartialEq for ResponseBody {
146152
fn eq(&self, other: &Self) -> bool {
147153
#[allow(clippy::match_same_arms)]

0 commit comments

Comments
 (0)