Struct ic_cdk::api::management_canister::http_request::TransformContext
source · pub struct TransformContext {
pub function: TransformFunc,
pub context: Vec<u8>,
}Expand description
Type used for encoding/decoding: `record {
Fields§
§function: TransformFuncReference function with signature: func (record {response : http_response; context : blob}) -> (http_response) query;.
context: Vec<u8>Context to be passed to transform function to transform HTTP response for consensus
Implementations§
source§impl TransformContext
impl TransformContext
sourcepub fn new<T>(func: T, context: Vec<u8>) -> Selfwhere
T: Fn(TransformArgs) -> HttpResponse,
pub fn new<T>(func: T, context: Vec<u8>) -> Selfwhere
T: Fn(TransformArgs) -> HttpResponse,
Construct TransformContext from a transform function.
example
#[ic_cdk::query]
fn my_transform(arg: TransformArgs) -> HttpResponse {
// ...
}
let transform = TransformContext::new(my_transform, context);Trait Implementations§
source§impl CandidType for TransformContext
impl CandidType for TransformContext
source§impl Clone for TransformContext
impl Clone for TransformContext
source§fn clone(&self) -> TransformContext
fn clone(&self) -> TransformContext
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for TransformContext
impl Debug for TransformContext
source§impl<'de> Deserialize<'de> for TransformContext
impl<'de> Deserialize<'de> for TransformContext
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<TransformContext> for TransformContext
impl PartialEq<TransformContext> for TransformContext
source§fn eq(&self, other: &TransformContext) -> bool
fn eq(&self, other: &TransformContext) -> bool
This method tests for
self and other values to be equal, and is used
by ==.