Enum cosmwasm_std::CosmosMsg
source · #[non_exhaustive]pub enum CosmosMsg<T = Empty> {
Bank(BankMsg),
Custom(T),
Staking(StakingMsg),
Distribution(DistributionMsg),
Stargate {
type_url: String,
value: Binary,
},
Any(AnyMsg),
Ibc(IbcMsg),
Wasm(WasmMsg),
Gov(GovMsg),
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bank(BankMsg)
Custom(T)
Staking(StakingMsg)
Distribution(DistributionMsg)
Stargate
👎Deprecated: Use
CosmosMsg::Any
instead (if you only target CosmWasm 2+ chains)This is the same structure as messages in TxBody
from ADR-020
Fields
Any(AnyMsg)
CosmosMsg::Any
is the replaces the “stargate message” – a message wrapped
in a protobuf Any
that is suppored by the chain. It behaves the same as
CosmosMsg::Stargate
but has a better name and slightly improved syntax.
This is feature-gated at compile time with cosmwasm_2_0
because
a chain running CosmWasm < 2.0 cannot process this.
Ibc(IbcMsg)
Wasm(WasmMsg)
Gov(GovMsg)
Implementations§
source§impl<T> CosmosMsg<T>
impl<T> CosmosMsg<T>
sourcepub fn change_custom<U>(self) -> Option<CosmosMsg<U>>
pub fn change_custom<U>(self) -> Option<CosmosMsg<U>>
Convert this this CosmosMsg<T>
to a CosmosMsg<U>
with a different custom message type.
This allows easier interactions between code written for a specific chain and
code written for multiple chains.
If this is the CosmosMsg::Custom
variant, the function returns None
.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for CosmosMsg<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for CosmosMsg<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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> From<DistributionMsg> for CosmosMsg<T>
impl<T> From<DistributionMsg> for CosmosMsg<T>
source§fn from(msg: DistributionMsg) -> Self
fn from(msg: DistributionMsg) -> Self
Converts to this type from the input type.
source§impl<T> From<StakingMsg> for CosmosMsg<T>
impl<T> From<StakingMsg> for CosmosMsg<T>
source§fn from(msg: StakingMsg) -> Self
fn from(msg: StakingMsg) -> Self
Converts to this type from the input type.
source§impl<T: JsonSchema> JsonSchema for CosmosMsg<T>
impl<T: JsonSchema> JsonSchema for CosmosMsg<T>
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreimpl<T: Eq> Eq for CosmosMsg<T>
impl<T> StructuralPartialEq for CosmosMsg<T>
Auto Trait Implementations§
impl<T> Freeze for CosmosMsg<T>where
T: Freeze,
impl<T> RefUnwindSafe for CosmosMsg<T>where
T: RefUnwindSafe,
impl<T> Send for CosmosMsg<T>where
T: Send,
impl<T> Sync for CosmosMsg<T>where
T: Sync,
impl<T> Unpin for CosmosMsg<T>where
T: Unpin,
impl<T> UnwindSafe for CosmosMsg<T>where
T: UnwindSafe,
Blanket Implementations§
source§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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