Trait tencent_scf::convert::IntoBytes [−][src]
Trait for converting response into raw bytes.
Custom response should implement this trait so that runtime can send raw bytes to the upstream cloud.
Implement the Trait
One needs to provide a method that can consume the object and produce a byte array.
use tencent_scf::convert::IntoBytes; // Our custom response type struct Response(String); // Simply turn a string into a byte array. impl IntoBytes for Response { type Error = std::convert::Infallible; fn into_bytes(self) -> Result<Vec<u8>, Self::Error> { Ok(String::into_bytes(self.0)) } }
Associated Types
type Error[src]
Possible error during the conversion. std::fmt::Display is all the runtime needs.
Required methods
fn into_bytes(self) -> Result<Vec<u8>, Self::Error>[src]
Consume the object and serialize it into a byte array.
Implementations on Foreign Types
impl IntoBytes for Vec<u8>[src]
Auto serialization for byte array (identity map).
type Error = Infallible
fn into_bytes(self) -> Result<Vec<u8>, Self::Error>[src]
impl IntoBytes for String[src]
Auto serilization for string.
type Error = Infallible
fn into_bytes(self) -> Result<Vec<u8>, Self::Error>[src]
Implementors
impl<T> IntoBytes for T where
T: Serialize + AsJson, [src]
T: Serialize + AsJson,
Auto serilization for types that are serde::Serialize and marked as AsJson.