Skip to content

Commit

Permalink
Fix highlighting in Sylvia examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jawoznia committed Dec 12, 2024
1 parent 1929600 commit c83ff48
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 41 deletions.
8 changes: 4 additions & 4 deletions src/pages/sylvia/basics/contract-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ state and define a behavior.
<Tabs items={['Storey', 'StoragePlus']}>
<Tabs.Tab>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use cw_storey::containers::Item;

pub struct CounterContract { pub count: Item<u64>, }
Expand All @@ -21,7 +21,7 @@ pub struct CounterContract { pub count: Item<u64>, }
</Tabs.Tab>
<Tabs.Tab>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use sylvia::cw_storage_plus::Item;

pub struct CounterContract { pub count: Item<u64>, }
Expand All @@ -38,7 +38,7 @@ Let's take a look at the behavior implementation.
<Tabs items={['Storey', 'StoragePlus']}>
<Tabs.Tab>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use cosmwasm_schema::cw_serde;
use cw_storey::CwStorage;
use sylvia::contract;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl CounterContract {
</Tabs.Tab>
<Tabs.Tab>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use cosmwasm_schema::cw_serde;
use sylvia::contract;
use sylvia::cw_std::{Response, StdError, StdResult};
Expand Down
6 changes: 3 additions & 3 deletions src/pages/sylvia/basics/interoperability.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type provides all the API as the MultiTest counterpart, exposing the underlying
support for using the Sylvia-generated helpers. It can also be used to simulate the execution of
standard CosmWasm contracts as well

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use sylvia::multitest::App;
use sylvia::cw_multi_test::BasicMtApp;

Expand All @@ -259,7 +259,7 @@ We can access the underlying
[`store_code`](https://docs.rs/cw-multi-test/latest/cw_multi_test/struct.App.html#method.store_code)
of the CosmWasm contract.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
fn cosmwasm_contract() -> Box<dyn Contract<Empty>> { ... }

let cosmwasm_code = app.app_mut().store_code(cosmwasm_contract());
Expand All @@ -268,7 +268,7 @@ let cosmwasm_code = app.app_mut().store_code(cosmwasm_contract());
To instantiate the CosmWasm contract, we will also use the
[`app_mut`](https://docs.rs/sylvia/latest/sylvia/multitest/struct.App.html#method.app_mut).

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
let cosmwasm_contract = app
.app_mut()
.instantiate_contract(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sylvia/macros/attributes/message.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ List of macros supporting the `sv::messages` attribute:

## Usage

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub mod interface {
use cosmwasm_schema::cw_serde;
use sylvia::cw_std::{Response, StdError, StdResult};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sylvia/macros/attributes/msg.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ requires however additional action. Due to
macro derive on generated `query` message, we have to explicitly provide the return type, as the
macro wouldn't be able to deduce that from the alias.

```rust, template="sylvia-cw-storage-contract"
```rust template="sylvia-cw-storage-contract"
#[sv::msg(query, resp=SomeResponse)]
fn some_query(&self, ctx: QueryCtx) -> SomeResult {
Ok(SomeResponse)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/sylvia/macros/attributes/override-entry-point.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ List of macros supporting the `sv::override_entry_point` attribute:

## Usage

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use self::sv::ContractExecMsg;

pub mod entrypoints {
Expand Down Expand Up @@ -81,7 +81,7 @@ that in the entry point.

An example of such an approach:

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use self::sv::ContractExecMsg;

pub mod entrypoints {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/sylvia/macros/contract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ List of attributes supported by

## Usage

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Contract;

#[cw_serde]
Expand Down Expand Up @@ -94,7 +94,7 @@ functionality of one contract with another one. In such a case you might want to
possibility for the user to use it with types that suits their purpose. You can do that by defining
generics on your contract.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use cw_storage_plus::Item;

pub struct Contract<ExecParamT, FieldT> {
Expand Down Expand Up @@ -178,7 +178,7 @@ it makes testing it in the [MultiTest](../../cw-multi-test) environment with dif
messages tricky. We recommend that if your contract is meant to be chain agnostic, define it with a
generic custom message and custom query.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Contract<CMsgT, CQueryT> {
_phantom: PhantomData<(CMsgT, CQueryT)>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/sylvia/macros/entry-points.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ List of attributes supported by `entry_points` macro:

## Usage

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[cfg(not(feature = "library"))]
use sylvia::entry_points;

Expand Down Expand Up @@ -66,7 +66,7 @@ You can construct your entry points to work with some specific custom types with
CosmWasm entry points cannot be generic. We are thus forced to provide concrete types to be used in
place of generic types used in the contract.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
use cw_storage_plus::Item;

#[cfg(not(feature = "library"))]
Expand Down
12 changes: 6 additions & 6 deletions src/pages/sylvia/macros/generated-types/communication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ implementing traits with methods representing execute and query methods

Examples in the following paragraphs are generated from the below contract:

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Contract;

#[contract]
Expand Down Expand Up @@ -49,7 +49,7 @@ Sylvia macros generate a `Querier` trait that mirrors all of the methods marked
[`BoundQuerier`](../../types/communication#boundquerier) type. Implementation of each method
constructs the appropriate message and sends it to the contract.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub trait Querier {
fn some_query(&self, addr: String) -> Result<SomeResponse, sylvia::cw_std::StdError>;
}
Expand All @@ -72,7 +72,7 @@ constructs the appropriate message and returns the
[`ExecutorBuilder`](../../types/communication#executorbuilder) generic over
[`ReadyExecutorBuilderState`](https://docs.rs/sylvia/latest/sylvia/types/struct.ReadyExecutorBuilderState.html).

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub trait Executor {
fn some_exec(
self,
Expand Down Expand Up @@ -118,7 +118,7 @@ This trait was created for internal use of the generated code to ease work with

<Callout>We reserve the right to break the API of this trait between minor releases.</Callout>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
impl sylvia::types::ContractApi for Contract {
type ContractExec = ContractExecMsg;
type ContractQuery = ContractQueryMsg;
Expand Down Expand Up @@ -150,7 +150,7 @@ contracts.

<Callout>We reserve the right to break the API of this trait between the minor releases.</Callout>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Api<ExecC, QueryC, CounterT> {
_phantom: std::marker::PhantomData<(ExecC, QueryC, CounterT)>,
}
Expand Down Expand Up @@ -180,7 +180,7 @@ contracts.

<Callout>We reserve the right to break the API of this trait between the minor releases.</Callout>

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Api<ExecC, QueryC, CounterT> {
_phantom: std::marker::PhantomData<(ExecC, QueryC, CounterT)>,
}
Expand Down
26 changes: 13 additions & 13 deletions src/pages/sylvia/macros/generated-types/message-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ be called depending on the enum variant. This is described in the example below

The following code:

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[cw_serde]
pub struct SomeResponse;

Expand Down Expand Up @@ -64,7 +64,7 @@ generates the following messages for every respective [entrypoint](../../../core

<Tabs items={['InstantiateMsg', 'ExecMsg', 'QueryMsg', 'SudoMsg', 'MigrateMsg']} defaultIndex={0}>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -100,7 +100,7 @@ generates the following messages for every respective [entrypoint](../../../core
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -141,7 +141,7 @@ generates the following messages for every respective [entrypoint](../../../core
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -181,7 +181,7 @@ generates the following messages for every respective [entrypoint](../../../core
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -221,7 +221,7 @@ generates the following messages for every respective [entrypoint](../../../core
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -272,7 +272,7 @@ implemented on it, which are used as the main messages of the contract.

<Tabs items={['ContractExecMsg', 'ContractQueryMsg', 'ContractSudoMsg']} defaultIndex={0}>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(sylvia::serde::Serialize, Clone, Debug, PartialEq, sylvia::schemars::JsonSchema)]
#[serde(rename_all = "snake_case", untagged)]
Expand Down Expand Up @@ -307,7 +307,7 @@ implemented on it, which are used as the main messages of the contract.
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(sylvia::serde::Serialize, Clone, Debug, PartialEq, sylvia::schemars::JsonSchema)]
#[serde(rename_all = "snake_case", untagged)]
Expand Down Expand Up @@ -348,7 +348,7 @@ implemented on it, which are used as the main messages of the contract.
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(sylvia::serde::Serialize, Clone, Debug, PartialEq, sylvia::schemars::JsonSchema)]
#[serde(rename_all = "snake_case", untagged)]
Expand Down Expand Up @@ -399,7 +399,7 @@ three types of messages.

We will use the below example interface to generate the messages:

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[interface]
pub trait Interface {
type Error: From<StdError>;
Expand All @@ -420,7 +420,7 @@ And the three generated messages:

<Tabs items={['ExecMsg', 'QueryMsg', 'SudoMsg']} defaultIndex={0}>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -462,7 +462,7 @@ And the three generated messages:
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down Expand Up @@ -506,7 +506,7 @@ And the three generated messages:
```
</Tabs.Tab>
<Tabs.Tab>
```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
sylvia::serde::Serialize,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/sylvia/macros/interface.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ semantical parts of your contracts.

## Usage

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[cw_serde]
pub struct InterfaceQueryResp {}

Expand Down Expand Up @@ -54,7 +54,7 @@ If you want to allow the users to use the interface with their own specified cus
declare `ExecC` and `QueryC` associated types, where `ExecC` specifies the `CustomMsg` and `QueryC`
the `CustomQuery`.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[cw_serde]
pub struct InterfaceQueryResp {}

Expand Down Expand Up @@ -83,7 +83,7 @@ The `interface` macro does not support generics. Instead, you can provide generi
using the associated types. It's because Sylvia interfaces can be implemented only once per
contract, and in such a case, associated types are semantically correct in Rust.

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
#[interface]
pub trait Interface {
type Error: From<StdError>;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/sylvia/types/communication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ These methods are:

The `Remote` can be stored as a represantation of a specific contract:

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Contract<'a> {
remote: Item<Remote<'a, ExternalContract>>,
}
```

we can also store a `Remote` to some contract implementing an interface:

```rust, template="sylvia-empty"
```rust template="sylvia-empty"
pub struct Contract<'a> {
remote: Remote<
'a,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/sylvia/types/multitest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ by [`contract`](../macros/contract) and [`interface`](../macros/interface) macro
Example usage of utilities described on this page as well as ones defined on the
[`generated types`](../macros/generated-types/multitest) page:

```rust, template="sylvia-cw-storage-contract"
```rust template="sylvia-cw-storage-contract"
use sylvia::cw_multi_test::IntoAddr;
use sylvia::multitest::App;

Expand Down

0 comments on commit c83ff48

Please sign in to comment.