Skip to content

Commit ad62c70

Browse files
committed
Improve documentation for query response constructors
1 parent 6da0ab7 commit ad62c70

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/std/src/query/bank.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ pub struct SupplyResponse {
3333

3434
#[cfg(feature = "cosmwasm_1_1")]
3535
impl SupplyResponse {
36+
/// Constructor for testing frameworks such as cw-multi-test.
37+
/// This is required because query response types should be #[non_exhaustive].
38+
/// As a contract developer you should not need this constructor since
39+
/// query responses are constructed for you via deserialization.
40+
#[doc(hidden)]
3641
pub fn new(amount: Coin) -> Self {
3742
Self { amount }
3843
}

packages/std/src/query/wasm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ pub struct ContractInfoResponse {
4141
}
4242

4343
impl ContractInfoResponse {
44-
/// Convenience constructor for tests / mocks
44+
/// Constructor for testing frameworks such as cw-multi-test.
45+
/// This is required because query response types should be #[non_exhaustive].
46+
/// As a contract developer you should not need this constructor since
47+
/// query responses are constructed for you via deserialization.
4548
#[doc(hidden)]
4649
pub fn new(code_id: u64, creator: impl Into<String>) -> Self {
4750
Self {

0 commit comments

Comments
 (0)