Struct cosmwasm_std::SubMsg 
source · pub struct SubMsg<T = Empty> {
    pub id: u64,
    pub msg: CosmosMsg<T>,
    pub gas_limit: Option<u64>,
    pub reply_on: ReplyOn,
}Expand description
A submessage that will guarantee a reply call on success or error, depending on
the reply_on setting. If you do not need to process the result, use regular messages instead.
Note: On error the submessage execution will revert any partial state changes due to this message,
but not revert any state changes in the calling contract. If this is required, it must be done
manually in the reply entry point.
Fields§
§id: u64An arbitrary ID chosen by the contract.
This is typically used to match Replys in the reply entry point to the submessage.
msg: CosmosMsg<T>§gas_limit: Option<u64>Gas limit measured in Cosmos SDK gas.
reply_on: ReplyOnImplementations§
source§impl<T> SubMsg<T>
 
impl<T> SubMsg<T>
sourcepub fn new(msg: impl Into<CosmosMsg<T>>) -> Self
 
pub fn new(msg: impl Into<CosmosMsg<T>>) -> Self
new creates a “fire and forget” message with the pre-0.14 semantics
sourcepub fn reply_on_success(msg: impl Into<CosmosMsg<T>>, id: u64) -> Self
 
pub fn reply_on_success(msg: impl Into<CosmosMsg<T>>, id: u64) -> Self
create a SubMsg that will provide a reply with the given id if the message returns Ok
sourcepub fn reply_on_error(msg: impl Into<CosmosMsg<T>>, id: u64) -> Self
 
pub fn reply_on_error(msg: impl Into<CosmosMsg<T>>, id: u64) -> Self
create a SubMsg that will provide a reply with the given id if the message returns Err
sourcepub fn reply_always(msg: impl Into<CosmosMsg<T>>, id: u64) -> Self
 
pub fn reply_always(msg: impl Into<CosmosMsg<T>>, id: u64) -> Self
create a SubMsg that will always provide a reply with the given id
sourcepub fn with_gas_limit(self, limit: u64) -> Self
 
pub fn with_gas_limit(self, limit: u64) -> Self
Add a gas limit to the message. This gas limit measured in Cosmos SDK gas.
Examples
let sub_msg: SubMsg = SubMsg::reply_always(msg, 1234).with_gas_limit(60_000);
assert_eq!(sub_msg.id, 1234);
assert_eq!(sub_msg.gas_limit, Some(60_000));
assert_eq!(sub_msg.reply_on, ReplyOn::Always);Trait Implementations§
source§impl<'de, T> Deserialize<'de> for SubMsg<T>where
    T: Deserialize<'de>,
 
impl<'de, T> Deserialize<'de> for SubMsg<T>where
    T: Deserialize<'de>,
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>,
source§impl<T: JsonSchema> JsonSchema for SubMsg<T>
 
impl<T: JsonSchema> JsonSchema for SubMsg<T>
source§fn schema_name() -> String
 
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
 
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
 
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
 
fn is_referenceable() -> bool
$ref keyword. Read more