Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
Revert "chore: remove alloc references" (#1375)
Browse files Browse the repository at this point in the history
Revert "chore: remove alloc references (#1367)"

This reverts commit 2424dd7.
  • Loading branch information
ra0x3 authored Sep 25, 2023
1 parent 7c109e8 commit 9a7515c
Show file tree
Hide file tree
Showing 32 changed files with 104 additions and 70 deletions.
4 changes: 3 additions & 1 deletion docs/src/designing-a-schema/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Account @entity {
This `Account` object type from the GraphQL schema, might be used in an indexer module like so:

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -43,6 +44,7 @@ enum SignatureLabel {
This `SignatureLabel` object type from the GraphQL schema, might be used in an indexer module like so:

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -106,10 +108,10 @@ type Transaction @entity {
This `Transaction` union type from the GraphQL schema, might be used in an indexer module like so:

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "indexer.manifest.yaml")]

mod indexer_mod {
fn handle_event(event: Event) {
let bytecode_length = 1024;
Expand Down
1 change: 1 addition & 0 deletions docs/src/indexing-fuel-types/blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct BlockData {
## Usage

```rust,ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down
14 changes: 11 additions & 3 deletions docs/src/indexing-fuel-types/receipts.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ pub struct Burn {
```

```rust, ignore
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
mod indexer_mod {
fn handle_burn_receipt(block_data: BlockData) {
let height = block_data.header.height;
Expand Down Expand Up @@ -71,6 +68,7 @@ pub struct Call {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -105,6 +103,7 @@ pub struct Log {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -144,6 +143,7 @@ pub struct LogData {
> Note: the example below will run both when the type `MyEvent` is logged as well as when `MyEvent` is returned from a function.
```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -173,6 +173,7 @@ pub struct MessageOut {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand All @@ -199,6 +200,7 @@ pub struct Mint {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -232,6 +234,7 @@ pub struct Panic {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -269,6 +272,7 @@ pub struct Return {
You can handle functions that produce a `Return` receipt type by adding a parameter with the type `Return`.

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -336,6 +340,7 @@ pub struct Revert {
| FailedAssert | 4 |

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -368,6 +373,7 @@ pub struct ScriptResult {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -405,6 +411,7 @@ pub struct Transfer {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -442,6 +449,7 @@ pub struct TransferOut {
```

```rust, ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down
2 changes: 2 additions & 0 deletions docs/src/indexing-fuel-types/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct TransactionData {
### Usage

```rust,ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down Expand Up @@ -67,6 +68,7 @@ pub enum TransactionStatus {
### Usage

```rust,ignore
extern crate alloc;
use fuel_indexer_utils::prelude::*;
#[indexer(manifest = "indexer.manifest.yaml")]
Expand Down
1 change: 1 addition & 0 deletions examples/fuel-explorer/fuel-explorer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

// TODO: We use a lot of manual type conversion below due to https://github.com/FuelLabs/fuel-indexer/issues/286
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//! ```bash
//! cargo run -p hello-world-data --bin hello-world-data
//! ```
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(
Expand Down
1 change: 1 addition & 0 deletions examples/hello-world/hello-indexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
//! cargo run -p hello-world-data --bin hello-world-data
//! ```
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "examples/hello-world/hello-indexer/hello_indexer.manifest.yaml")]
Expand Down
2 changes: 0 additions & 2 deletions packages/fuel-indexer-macros/src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ pub fn handler_block_native(
/// indexer module, not within the scope of the entire lib module.
fn native_prelude() -> proc_macro2::TokenStream {
quote! {
extern crate alloc;

type B256 = [u8; 32];

static mut db: Option<Arc<Mutex<Database>>> = None;
Expand Down
2 changes: 0 additions & 2 deletions packages/fuel-indexer-macros/src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ pub fn handler_block_wasm(
/// indexer module, not within the scope of the entire lib module.
fn wasm_prelude() -> proc_macro2::TokenStream {
quote! {
extern crate alloc;

use alloc::{format, vec, vec::Vec};
use std::str::FromStr;

Expand Down
1 change: 1 addition & 0 deletions packages/fuel-indexer-plugin/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate alloc;

use alloc::vec::Vec;
use fuel_indexer_lib::{
graphql::MAX_FOREIGN_KEY_LIST_FIELDS,
Expand Down
2 changes: 2 additions & 0 deletions packages/fuel-indexer-schema/src/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use crate::FtColumn;
use fuel_indexer_lib::join_table_typedefs_name;
use serde::{Deserialize, Serialize};

extern crate alloc;

/// Details for the many-to-many relationship.
///
/// This is essentially the same as `fuel_indexer_lib::graphql::parser::JoinTableRelation`, just
Expand Down
2 changes: 2 additions & 0 deletions packages/fuel-indexer-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// TODO: Deny `clippy::unused_crate_dependencies` when including feature-flagged dependency `itertools`

extern crate alloc;

use fuel_indexer_lib::MAX_ARRAY_LENGTH;
use fuel_indexer_types::{fuel::*, scalar::*, Identity};
use serde::{Deserialize, Serialize};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
extern crate alloc;

use fuel_indexer_utils::prelude::*;

#[indexer(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/indexers/simple-wasm/simple_wasm.yaml")]
Expand Down
1 change: 1 addition & 0 deletions packages/fuel-indexer-tests/tests/service.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extern crate alloc;
use fuel_indexer::prelude::fuel::{BlockData, Consensus, Header};
use fuel_indexer::{Executor, IndexerConfig, WasmIndexExecutor};
use fuel_indexer_lib::WasmIndexerError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[indexer(manifest = "packages/fuel-indexer-tests/trybuild/invalid_abi_type_simple_wasm.yaml")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extern crate alloc;
use fuel_indexer_utils::prelude::*;

#[no_mangle]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
extern crate alloc;
use fuel_indexer_utils::prelude::indexer;

#[no_mangle]
Expand Down
Loading

0 comments on commit 9a7515c

Please sign in to comment.