fn full<T: Into<Bytes>>(chunk: T) -> BoxBody {
Full::new(chunk.into())
.map_err(|never| match never {})
.boxed()
}
fn index() -> Result<Response<BoxBody>> {
let cow_of_shift_jis_u8 = SHIFT_JIS.encode("あいうえお"); // encoding_rs::SHIFT_JIS encoding-rs crate
Ok(Response::builder()
.header("Content-Type", "text/plain; charset=shift_jis")
.status(StatusCode::OK)
.body(full(cow_of_shift_jis_u8.0.into_owned().into_boxed_slice()))?)
}
into_owned で Vec<u8> にして、into_boxed_slice で Box<[u8]> に変換