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
sourceimpl 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 TransformType from a transform function.
example
ⓘ
#[ic_cdk_macros::query]
fn my_transform(arg: TransformArgs) -> HttpResponse {
...
}
let transform = TransformType::from_transform_function(my_transform);Trait Implementations
sourceimpl CandidType for TransformContext
impl CandidType for TransformContext
sourceimpl Clone for TransformContext
impl Clone for TransformContext
sourcefn clone(&self) -> TransformContext
fn clone(&self) -> TransformContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for TransformContext
impl Debug for TransformContext
sourceimpl<'de> Deserialize<'de> for TransformContext
impl<'de> Deserialize<'de> for TransformContext
sourcefn 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
sourceimpl PartialEq<TransformContext> for TransformContext
impl PartialEq<TransformContext> for TransformContext
sourcefn eq(&self, other: &TransformContext) -> bool
fn eq(&self, other: &TransformContext) -> bool
impl StructuralPartialEq for TransformContext
Auto Trait Implementations
impl RefUnwindSafe for TransformContext
impl Send for TransformContext
impl Sync for TransformContext
impl Unpin for TransformContext
impl UnwindSafe for TransformContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more