pub struct ResponseBuilder { /* private fields */ }
Expand description
Helper data type, following builder pattern, for constructing a [Response].
Implementations§
§impl ResponseBuilder
impl ResponseBuilder
pub fn new(contract_version: ContractVersion) -> ResponseBuilder
pub fn new(contract_version: ContractVersion) -> ResponseBuilder
Initialize a new builder.
pub fn new_mute_events() -> ResponseBuilder
pub fn new_mute_events() -> ResponseBuilder
Create a response where the event methods are no-ops.
pub fn into_response(self) -> Response
pub fn into_response(self) -> Response
Finalize the builder and generate the final response.
pub fn add_message(&mut self, msg: impl Into<CosmosMsg>)
pub fn add_message(&mut self, msg: impl Into<CosmosMsg>)
Add a new [CosmosMsg] to the response.
pub fn add_instantiate_submessage<I, A, L, T>(
&mut self,
id: I,
admin: A,
code_id: u64,
label: L,
msg: &T
) -> Result<(), Error>where
I: Into<u64>,
A: Into<String>,
L: Into<String>,
T: Serialize,
pub fn add_instantiate_submessage<I, A, L, T>( &mut self, id: I, admin: A, code_id: u64, label: L, msg: &T ) -> Result<(), Error>where I: Into<u64>, A: Into<String>, L: Into<String>, T: Serialize,
Add a submessage for instantiating a new contract.
pub fn add_execute_submessage_oneshot<C, T>(
&mut self,
contract: C,
msg: &T
) -> Result<(), Error>where
C: Into<String>,
T: Serialize,
pub fn add_execute_submessage_oneshot<C, T>( &mut self, contract: C, msg: &T ) -> Result<(), Error>where C: Into<String>, T: Serialize,
Add a new one-shot submessage execution.
pub fn add_raw_submessage(&mut self, msg: SubMsg)
pub fn add_raw_submessage(&mut self, msg: SubMsg)
Add a raw submsg. Helpful if you need to handle a reply.
pub fn get_data<T>(&self) -> Result<Option<T>, Error>where
T: DeserializeOwned,
pub fn get_data<T>(&self) -> Result<Option<T>, Error>where T: DeserializeOwned,
Get response data
pub fn remove_data(&mut self)
pub fn remove_data(&mut self)
Remove response data
pub fn update_data<T>(
&mut self,
f: impl FnOnce(Option<T>) -> T
) -> Result<(), Error>where
T: Serialize + DeserializeOwned,
pub fn update_data<T>( &mut self, f: impl FnOnce(Option<T>) -> T ) -> Result<(), Error>where T: Serialize + DeserializeOwned,
Update response data
pub fn into_ibc_response(self) -> IbcBasicResponse
pub fn into_ibc_response(self) -> IbcBasicResponse
Turn the accumulated response into an IBC Basic response
pub fn into_ibc_recv_response_success(self) -> IbcReceiveResponse
pub fn into_ibc_recv_response_success(self) -> IbcReceiveResponse
Turn the accumulated response into an IBC Receive success response
pub fn into_ibc_recv_response_fail(self, error: Error) -> IbcReceiveResponse
pub fn into_ibc_recv_response_fail(self, error: Error) -> IbcReceiveResponse
Turn the accumulated response into an IBC Receive fail response
Auto Trait Implementations§
impl RefUnwindSafe for ResponseBuilder
impl Send for ResponseBuilder
impl Sync for ResponseBuilder
impl Unpin for ResponseBuilder
impl UnwindSafe for ResponseBuilder
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more