Struct levana_perpswap_cosmos::prelude::ResponseBuilder
source · pub struct ResponseBuilder { /* private fields */ }
Expand description
Helper data type, following builder pattern, for constructing a [Response].
Implementations§
source§impl ResponseBuilder
impl ResponseBuilder
sourcepub fn new_mute_events() -> Self
pub fn new_mute_events() -> Self
Create a response where the event methods are no-ops.
sourcepub fn into_response(self) -> Response
pub fn into_response(self) -> Response
Finalize the builder and generate the final response.
sourcepub fn add_message(&mut self, msg: impl Into<CosmosMsg<Empty>>)
pub fn add_message(&mut self, msg: impl Into<CosmosMsg<Empty>>)
Add a new [CosmosMsg] to the response.
sourcepub fn add_instantiate_submessage<I: Into<u64>, A: Into<String>, L: Into<String>, T: Serialize>(
&mut self,
id: I,
admin: A,
code_id: u64,
label: L,
msg: &T,
) -> Result<()>
pub fn add_instantiate_submessage<I: Into<u64>, A: Into<String>, L: Into<String>, T: Serialize>( &mut self, id: I, admin: A, code_id: u64, label: L, msg: &T, ) -> Result<()>
Add a submessage for instantiating a new contract.
sourcepub fn add_execute_submessage_oneshot<C: Into<String>, T: Serialize>(
&mut self,
contract: C,
msg: &T,
) -> Result<()>
pub fn add_execute_submessage_oneshot<C: Into<String>, T: Serialize>( &mut self, contract: C, msg: &T, ) -> Result<()>
Add a new one-shot submessage execution.
sourcepub fn add_raw_submessage(&mut self, msg: SubMsg<Empty>)
pub fn add_raw_submessage(&mut self, msg: SubMsg<Empty>)
Add a raw submsg. Helpful if you need to handle a reply.
sourcepub fn get_data<T: DeserializeOwned>(&self) -> Result<Option<T>>
pub fn get_data<T: DeserializeOwned>(&self) -> Result<Option<T>>
Get response data
sourcepub fn remove_data(&mut self)
pub fn remove_data(&mut self)
Remove response data
sourcepub fn update_data<T: Serialize + DeserializeOwned>(
&mut self,
f: impl FnOnce(Option<T>) -> T,
) -> Result<()>
pub fn update_data<T: Serialize + DeserializeOwned>( &mut self, f: impl FnOnce(Option<T>) -> T, ) -> Result<()>
Update response data
sourcepub fn into_ibc_response(self) -> IbcBasicResponse
pub fn into_ibc_response(self) -> IbcBasicResponse
Turn the accumulated response into an IBC Basic response
sourcepub 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
sourcepub 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 Freeze for ResponseBuilder
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more