allow async api methods to return Response<Bytes>

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-06-08 13:05:56 +02:00
parent 3f7e4c0eda
commit dcfa3ca9a2
2 changed files with 3 additions and 1 deletions

View File

@ -196,7 +196,6 @@ fn handle_function(
if item.asyncness.is_some() { if item.asyncness.is_some() {
// An async function is expected to return its value, so we wrap it a bit: // An async function is expected to return its value, so we wrap it a bit:
body.push(quote! { body.push(quote! {
// Our helper type derefs to a wrapper performing input validation and returning a // Our helper type derefs to a wrapper performing input validation and returning a
// Pin<Box<Future>>. // Pin<Box<Future>>.

View File

@ -317,6 +317,9 @@ unconstrained_api_type! {&str}
unconstrained_api_type! {String, isize, usize, i64, u64, i32, u32, i16, u16, i8, u8, f64, f32} unconstrained_api_type! {String, isize, usize, i64, u64, i32, u32, i16, u16, i8, u8, f64, f32}
unconstrained_api_type! {Vec<String>} unconstrained_api_type! {Vec<String>}
// Raw return types are also okay:
unconstrained_api_type! {Response<Bytes>}
// FIXME: make const once feature(const_fn) is stable! // FIXME: make const once feature(const_fn) is stable!
pub fn get_type_info<T: ApiType>() -> &'static TypeInfo { pub fn get_type_info<T: ApiType>() -> &'static TypeInfo {
T::type_info() T::type_info()