pub struct ResponseBuilder { /* private fields */ }
Expand description

Helper data type, following builder pattern, for constructing a [Response].

Implementations§

§

impl ResponseBuilder

pub fn new(contract_version: ContractVersion) -> ResponseBuilder

Initialize a new builder.

pub fn new_mute_events() -> ResponseBuilder

Create a response where the event methods are no-ops.

pub fn into_response(self) -> Response

Finalize the builder and generate the final response.

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,

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,

Add a new one-shot submessage execution.

pub fn add_raw_submessage(&mut self, msg: SubMsg)

Add a raw submsg. Helpful if you need to handle a reply.

pub fn add_event(&mut self, event: impl Into<Event>)

Add an event to the response.

pub fn set_data(&mut self, data: &impl Serialize) -> Result<(), Error>

Set response data

pub fn get_data<T>(&self) -> Result<Option<T>, Error>where T: DeserializeOwned,

Get response data

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,

Update response data

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

Turn the accumulated response into an IBC Receive success response

pub fn into_ibc_recv_response_fail(self, error: Error) -> IbcReceiveResponse

Turn the accumulated response into an IBC Receive fail response

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for 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 more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.