repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/abi_impl_methods_callable/mod.rs
test/src/sdk-harness/test_projects/abi_impl_methods_callable/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "AbiImplMethodsCallable", abi = "test_projects/abi_impl_methods_callable/out/release/abi_impl_methods_callable-abi.json" )); async fn get_abi_impl_methods_callable_instance() -> AbiImplMethodsCallable<Wallet> { let wallet = launch_provider_and_get_wallet().a...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/option_field_order/mod.rs
test/src/sdk-harness/test_projects/option_field_order/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "MyContract", abi = "test_projects/option_field_order/out/release/option_field_order-abi.json" )); #[tokio::test] async fn default_is_none() { let instance = setup().await; assert!(instance.methods().is_none().call().await.unwrap().value); } async fn se...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/asset_id/mod.rs
test/src/sdk-harness/test_projects/asset_id/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestAssetId", abi = "test_projects/asset_id/out/release/asset_id-abi.json" )); #[tokio::test] async fn can_get_base_asset_id() { let wallet = launch_provider_and_get_wallet().await.unwrap(); let (fuelcontract_instance, _fuelcontract_id) = get_instance(w...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/predicate_panic_expression/mod.rs
test/src/sdk-harness/test_projects/predicate_panic_expression/mod.rs
use fuel_vm::fuel_asm::{op, RegId}; use fuel_vm::fuel_tx; use fuel_vm::fuel_tx::{Address, AssetId, Output}; use fuels::{ core::codec::{ABIEncoder, EncoderConfig}, prelude::*, types::{input::Input, transaction_builders::ScriptTransactionBuilder, Token}, }; use std::str::FromStr; async fn setup() -> (Vec<u8>...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/vec_in_abi/mod.rs
test/src/sdk-harness/test_projects/vec_in_abi/mod.rs
use fuels::{prelude::*, programs::calls::ContractCall, types::Bits256}; use std::str::FromStr; abigen!(Contract( name = "VecInAbiTestContract", abi = "test_projects/vec_in_abi/out/release/vec_in_abi-abi.json" )); async fn get_vec_in_abi_instance() -> (VecInAbiTestContract<Wallet>, ContractId) { let wallet...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/events/mod.rs
test/src/sdk-harness/test_projects/events/mod.rs
use fuels::prelude::*; #[tokio::test] async fn emits_indexed_events() -> Result<()> { abigen!(Script( name = "Events", abi = "test_projects/events/out/release/events-abi.json", )); let wallet = launch_provider_and_get_wallet().await.unwrap(); let bin_path = "test_projects/events/out/re...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/predicate_data_struct/mod.rs
test/src/sdk-harness/test_projects/predicate_data_struct/mod.rs
use fuel_vm::fuel_asm::{op, RegId}; use fuel_vm::fuel_tx; use fuel_vm::fuel_tx::{Address, AssetId, Output}; use fuels::{ core::codec::{ABIEncoder, EncoderConfig}, prelude::*, types::{input::Input, transaction_builders::ScriptTransactionBuilder, Token}, }; use std::str::FromStr; async fn setup() -> (Vec<u8>...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/superabi/mod.rs
test/src/sdk-harness/test_projects/superabi/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "SuperAbiTestContract", abi = "test_projects/superabi/out/release/superabi-abi.json" )); async fn get_superabi_instance() -> SuperAbiTestContract<Wallet> { let wallet = launch_provider_and_get_wallet().await.unwrap(); let id = Contract::load_from( ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/registers/mod.rs
test/src/sdk-harness/test_projects/registers/mod.rs
use fuel_vm::consts::VM_MAX_RAM; use fuels::prelude::*; abigen!(Contract( name = "TestRegistersContract", abi = "test_projects/registers/out/release/registers-abi.json", )); // Compile contract, create node and deploy contract, returning TestRegistersContract contract instance // TO DO : // - Ability to r...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/result_option_expect/mod.rs
test/src/sdk-harness/test_projects/result_option_expect/mod.rs
use fuels::{accounts::wallet::Wallet, prelude::*}; abigen!(Contract( name = "ExpectTestingContract", abi = "test_projects/result_option_expect/out/release/result_option_expect-abi.json" )); async fn setup() -> (ExpectTestingContract<Wallet>, ContractId) { let wallet = launch_provider_and_get_wallet().awai...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_string/mod.rs
test/src/sdk-harness/test_projects/storage_string/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestStorageStringContract", abi = "test_projects/storage_string/out/release/storage_string-abi.json", )); async fn setup() -> TestStorageStringContract<Wallet> { let mut node_config = NodeConfig::default(); node_config.starting_gas_price = 0; let mu...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/superabi_supertrait/mod.rs
test/src/sdk-harness/test_projects/superabi_supertrait/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "SuperAbiSuperTraitTestContract", abi = "test_projects/superabi_supertrait/out/release/superabi_supertrait-abi.json" )); async fn get_superabi_supertrait_instance() -> SuperAbiSuperTraitTestContract<Wallet> { let wallet = launch_provider_and_get_wallet().awa...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/ec_recover/mod.rs
test/src/sdk-harness/test_projects/ec_recover/mod.rs
use fuel_vm::{ fuel_crypto::{Message, PublicKey, SecretKey, Signature}, fuel_tx::Bytes64, fuel_types::Bytes32, }; use fuels::{accounts::signers::private_key::PrivateKeySigner, prelude::*, types::Bits256}; use rand::{rngs::StdRng, Rng, SeedableRng}; abigen!(Contract( name = "EcRecoverContract", abi ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_namespace/mod.rs
test/src/sdk-harness/test_projects/storage_namespace/mod.rs
use fuels::{ prelude::*, types::{Bits256, SizedAsciiString}, }; abigen!(Contract( name = "TestStorageContract", abi = "test_projects/storage_namespace/out/release/storage-namespace-abi.json", )); async fn get_test_storage_instance() -> TestStorageContract<Wallet> { let wallet = launch_provider_and...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_bytes/mod.rs
test/src/sdk-harness/test_projects/storage_bytes/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestStorageBytesContract", abi = "test_projects/storage_bytes/out/release/storage_bytes-abi.json", )); async fn setup() -> TestStorageBytesContract<Wallet> { let wallet = launch_provider_and_get_wallet().await.unwrap(); let id = Contract::load_from( ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/generics_in_abi/mod.rs
test/src/sdk-harness/test_projects/generics_in_abi/mod.rs
use fuels::{prelude::*, types::Bits256}; abigen!(Contract( name = "GenericsInAbiTestContract", abi = "test_projects/generics_in_abi/out/release/generics_in_abi-abi.json" )); async fn get_generics_in_abi_instance() -> (GenericsInAbiTestContract<Wallet>, ContractId) { let wallet = launch_provider_and_get_wa...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/ec_recover_and_match_predicate/mod.rs
test/src/sdk-harness/test_projects/ec_recover_and_match_predicate/mod.rs
use fuels::{ accounts::{predicate::Predicate, signers::private_key::PrivateKeySigner}, crypto::Message, prelude::*, types::B512, }; abigen!( Predicate( name = "TestPredicate", abi = "test_projects/ec_recover_and_match_predicate/out/release/ec_recover_and_match_predicate-abi.json" ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/evm_ec_recover/mod.rs
test/src/sdk-harness/test_projects/evm_ec_recover/mod.rs
use fuel_vm::{ fuel_crypto::{Message, PublicKey, SecretKey, Signature}, fuel_types::Bytes64, }; use fuels::{ accounts::signers::private_key::PrivateKeySigner, prelude::*, types::{Bits256, Bytes32, EvmAddress}, }; use rand::{rngs::StdRng, Rng, SeedableRng}; use sha3::{Digest, Keccak256}; abigen!(Con...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec_of_storage_string/mod.rs
test/src/sdk-harness/test_projects/storage_vec_of_storage_string/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestStorageVecOfStorageStringContract", abi = "test_projects/storage_vec_of_storage_string/out/release/storage_vec_of_storage_string-abi.json", )); async fn test_storage_vec_of_storage_string_instance( ) -> TestStorageVecOfStorageStringContract<Wallet> { le...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/private_struct_fields_in_storage_and_abi/mod.rs
test/src/sdk-harness/test_projects/private_struct_fields_in_storage_and_abi/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestPrivateStructFieldsInStorageAndAbi", abi = "test_projects/private_struct_fields_in_storage_and_abi/out/release/private_struct_fields_in_storage_and_abi-abi.json", )); async fn test_storage_private_struct_fields_instance( ) -> TestPrivateStructFieldsInStorag...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/low_level_call/mod.rs
test/src/sdk-harness/test_projects/low_level_call/mod.rs
use fuel_vm::fuel_tx::{ output::contract::Contract as OutputContract, Bytes32, ContractId, Output, TxPointer, UtxoId, }; use fuels::{ core::codec::*, prelude::*, types::{input::Input, Bits256, SizedAsciiString}, }; macro_rules! fn_selector { ( $fn_name: ident ( $($fn_arg: ty),* ) ) => { en...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_vec_nested/mod.rs
test/src/sdk-harness/test_projects/storage_vec_nested/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestStorageVecNestedContract", abi = "test_projects/storage_vec_nested/out/release/storage_vec_nested-abi.json", )); async fn test_storage_vec_nested_instance() -> TestStorageVecNestedContract<Wallet> { let wallet = launch_provider_and_get_wallet().await.un...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_init/mod.rs
test/src/sdk-harness/test_projects/storage_init/mod.rs
use fuels::prelude::*; abigen!(Contract( name = "TestStorageInitContract", abi = "test_projects/storage_init/out/release/storage_init-abi.json", )); async fn test_storage_init_instance() -> TestStorageInitContract<Wallet> { let wallet = launch_provider_and_get_wallet().await.unwrap(); let id = Contrac...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/storage_access/mod.rs
test/src/sdk-harness/test_projects/storage_access/mod.rs
use fuels::{prelude::*, types::Bits256}; abigen!(Contract( name = "TestStorageAccessContract", abi = "test_projects/storage_access/out/release/storage_access-abi.json", )); async fn test_storage_access_instance() -> TestStorageAccessContract<Wallet> { let wallet = launch_provider_and_get_wallet().await.un...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/result_in_abi/mod.rs
test/src/sdk-harness/test_projects/result_in_abi/mod.rs
use fuels::{prelude::*, types::Bits256}; use std::str::FromStr; abigen!(Contract( name = "ResultInAbiTestContract", abi = "test_projects/result_in_abi/out/release/result_in_abi-abi.json" )); async fn get_result_in_abi_instance() -> (ResultInAbiTestContract<Wallet>, ContractId) { let wallet = launch_provid...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/asset_ops/mod.rs
test/src/sdk-harness/test_projects/asset_ops/mod.rs
use fuels::{ prelude::*, types::{Bits256, Bytes32, Identity}, }; use sha2::{Digest, Sha256}; use std::str::FromStr; abigen!(Contract( name = "TestFuelCoinContract", abi = "test_projects/asset_ops/out/release/asset_ops-abi.json" )); #[tokio::test] async fn can_mint() { let wallet = launch_provider_...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/context/mod.rs
test/src/sdk-harness/test_projects/context/mod.rs
use fuel_vm::consts::VM_MAX_RAM; use fuels::{ prelude::*, tx::ContractIdExt, types::{Bits256, SubAssetId, ContractId}, }; abigen!( Contract( name = "TestContextContract", abi = "test_projects/context/out/release/context-abi.json", ), Contract( name = "TestContextCallerCo...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/sdk-harness/test_projects/parsing_logs/mod.rs
test/src/sdk-harness/test_projects/parsing_logs/mod.rs
use fuels::{ prelude::*, types::{Bits256, SizedAsciiString}, }; abigen!(Contract( name = "ParsingLogsTestContract", abi = "test_projects/parsing_logs/out/release/parsing_logs-abi.json" )); async fn get_parsing_logs_instance() -> (ParsingLogsTestContract<Wallet>, ContractId) { let wallet = launch_p...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/e2e_vm_tests/util.rs
test/src/e2e_vm_tests/util.rs
pub trait VecExt<T> { /// Retains the elements specified by the predicate `f`, /// and returns the elements that were removed. fn retain_and_get_removed<F>(&mut self, f: F) -> Vec<T> where F: FnMut(&T) -> bool; } impl<T> VecExt<T> for Vec<T> { fn retain_and_get_removed<F>(&mut self, mut f: ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/e2e_vm_tests/mod.rs
test/src/e2e_vm_tests/mod.rs
// Please take a look in test_programs/README.md for details on how these tests work. mod harness; mod harness_callback_handler; mod util; use crate::e2e_vm_tests::harness::run_and_capture_output; use crate::{FilterConfig, RunConfig}; use anyhow::{anyhow, bail, Result}; use chrono::Local; use colored::*; use core::f...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/e2e_vm_tests/harness_callback_handler.rs
test/src/e2e_vm_tests/harness_callback_handler.rs
use normalize_path::NormalizePath as _; use std::{ collections::HashMap, path::PathBuf, str::FromStr as _, sync::{Arc, Mutex}, }; use sway_core::{ ir_generation::{get_encoding_representation, get_runtime_representation}, Engines, Observer, TypeInfo, }; use sway_ir::Type; fn stdout_logs(root: &s...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/e2e_vm_tests/harness.rs
test/src/e2e_vm_tests/harness.rs
use crate::e2e_vm_tests::harness_callback_handler::HarnessCallbackHandler; use super::RunConfig; use anyhow::{anyhow, bail, Result}; use colored::Colorize; use forc_client::{ cmd::{Deploy as DeployCommand, Run as RunCommand}, op::{deploy, run, DeployedPackage}, NodeTarget, }; use forc_pkg::{BuildProfile, B...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/test/src/snapshot/mod.rs
test/src/snapshot/mod.rs
use anyhow::Result; use libtest_mimic::{Arguments, Trial}; use normalize_path::NormalizePath; use regex::{Captures, Regex}; use std::{ collections::{BTreeSet, HashMap, VecDeque}, path::{Path, PathBuf}, str::FromStr, sync::Once, }; use sway_core::Engines; use sway_features::ExperimentalFeatures; use sway...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/attribute.rs
sway-parse/src/attribute.rs
use crate::priv_prelude::{Peek, Peeker}; use crate::{Parse, ParseBracket, ParseResult, ParseToEnd, Parser, ParserConsumed}; use sway_ast::attribute::{Annotated, Attribute, AttributeArg, AttributeDecl, AttributeHashKind}; use sway_ast::brackets::Parens; use sway_ast::keywords::{EqToken, HashBangToken, HashToken, Storag...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/path.rs
sway-parse/src/path.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::keywords::{DoubleColonToken, OpenAngleBracketToken, SelfToken, StorageToken}; use sway_ast::{ AngleBrackets, PathExpr, PathExprSegment, PathType, PathTypeSegment, QualifiedPathRoot, }; use sway_types::{Ident, Spanned}; impl Parse for PathExpr { fn parse(p...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/lib.rs
sway-parse/src/lib.rs
mod attribute; mod brackets; mod expr; mod generics; mod item; mod keywords; mod literal; mod module; mod parse; mod parser; mod path; mod pattern; mod priv_prelude; mod punctuated; mod submodule; #[cfg(test)] mod test_utils; mod token; mod ty; mod where_clause; use crate::priv_prelude::*; pub use crate::{ keyword...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/parse.rs
sway-parse/src/parse.rs
use crate::keywords::RESERVED_KEYWORDS; use crate::{ParseResult, Parser, ParserConsumed, Peeker}; use sway_ast::Intrinsic; use sway_error::parser_error::ParseErrorKind; use sway_types::{ast::Delimiter, Ident, Spanned}; pub trait Parse { const FALLBACK_ERROR: ParseErrorKind = ParseErrorKind::InvalidItem; fn p...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/pattern.rs
sway-parse/src/pattern.rs
use crate::{Parse, ParseBracket, ParseResult, Parser, Peek}; use sway_ast::brackets::{Braces, Parens}; use sway_ast::keywords::{DoubleDotToken, FalseToken, TrueToken}; use sway_ast::literal::{LitBool, LitBoolType}; use sway_ast::punctuated::Punctuated; use sway_ast::{Literal, PathExpr, Pattern, PatternStructField}; us...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/parser.rs
sway-parse/src/parser.rs
use crate::{Parse, ParseToEnd, Peek}; use core::marker::PhantomData; use std::cell::RefCell; use sway_ast::keywords::Keyword; use sway_ast::literal::Literal; use sway_ast::token::{ DocComment, GenericTokenTree, Group, Punct, Spacing, TokenStream, TokenTree, }; use sway_ast::PubToken; use sway_error::error::CompileE...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/where_clause.rs
sway-parse/src/where_clause.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::punctuated::Punctuated; use sway_ast::{WhereBound, WhereClause}; impl Parse for WhereClause { fn parse(parser: &mut Parser) -> ParseResult<WhereClause> { let where_token = parser.parse()?; let mut value_separator_pairs = Vec::new(); le...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/module.rs
sway-parse/src/module.rs
use crate::{Parse, ParseResult, ParseToEnd, Parser, ParserConsumed}; use sway_ast::{attribute::Annotated, Module, ModuleKind}; use sway_error::parser_error::ParseErrorKind; impl Parse for ModuleKind { fn parse(parser: &mut Parser) -> ParseResult<Self> { if let Some(script_token) = parser.take() { ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/priv_prelude.rs
sway-parse/src/priv_prelude.rs
pub use crate::{ brackets::ParseBracket, parse::{ParseToEnd, Peek}, parser::{ParseResult, ParserConsumed, Peeker}, };
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/keywords.rs
sway-parse/src/keywords.rs
use crate::{Parse, ParseResult, Parser, Peek, Peeker}; use sway_ast::keywords::*; use sway_error::parser_error::ParseErrorKind; use sway_types::Spanned; fn peek_keyword<T: Keyword>(peeker: Peeker<'_>) -> Option<T> { let ident = peeker.peek_ident().ok()?; (!ident.is_raw_ident() && ident.as_str() == T::AS_STR)....
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/submodule.rs
sway-parse/src/submodule.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::submodule::Submodule; impl Parse for Submodule { fn parse(parser: &mut Parser) -> ParseResult<Submodule> { let visibility = parser.take(); let mod_token = parser.parse()?; let name = parser.parse()?; let semicolon_token = parse...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/test_utils.rs
sway-parse/src/test_utils.rs
use crate::{priv_prelude::ParseToEnd, Parse, Parser}; use sway_error::handler::Handler; use sway_features::ExperimentalFeatures; pub fn parse<T>(input: &str) -> T where T: Parse, { let handler = Handler::default(); let ts = crate::token::lex(&handler, input.into(), 0, input.len(), None).unwrap(); let r...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/punctuated.rs
sway-parse/src/punctuated.rs
use crate::{Parse, ParseResult, ParseToEnd, Parser, ParserConsumed}; use sway_ast::punctuated::Punctuated; impl<T, P> ParseToEnd for Punctuated<T, P> where T: Parse, P: Parse, { fn parse_to_end<'a, 'e>( mut parser: Parser<'a, '_>, ) -> ParseResult<(Punctuated<T, P>, ParserConsumed<'a>)> { ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/generics.rs
sway-parse/src/generics.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::generics::GenericParam; use sway_ast::keywords::{ColonToken, CommaToken, ConstToken}; use sway_ast::punctuated::Punctuated; use sway_ast::{AngleBrackets, GenericArgs, GenericParams}; use sway_types::Ident; impl Parse for GenericParam { fn parse(parser: &mut P...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/literal.rs
sway-parse/src/literal.rs
use crate::{Parse, ParseResult, Parser, Peek, Peeker}; use sway_ast::Literal; use sway_error::parser_error::ParseErrorKind; impl Peek for Literal { fn peek(peeker: Peeker<'_>) -> Option<Literal> { peeker.peek_literal().ok().cloned() } } impl Parse for Literal { fn parse(parser: &mut Parser) -> Pa...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/brackets.rs
sway-parse/src/brackets.rs
use crate::{Parse, ParseResult, ParseToEnd, Parser}; use sway_ast::brackets::{Braces, Parens, SquareBrackets}; use sway_error::handler::ErrorEmitted; use sway_error::parser_error::ParseErrorKind; use sway_types::ast::Delimiter; pub trait ParseBracket<T>: Sized { fn try_parse(parser: &mut Parser) -> ParseResult<Op...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/token.rs
sway-parse/src/token.rs
use core::mem; use extension_trait::extension_trait; use num_bigint::BigUint; use sway_ast::literal::{LitChar, LitInt, LitIntType, LitString, Literal}; use sway_ast::token::{ Comment, CommentKind, CommentedGroup, CommentedTokenStream, CommentedTokenTree, DocComment, DocStyle, Punct, Spacing, TokenStream, }; use...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/expr/asm.rs
sway-parse/src/expr/asm.rs
use crate::expr::op_code::parse_instruction; use crate::{Parse, ParseResult, ParseToEnd, Parser, ParserConsumed}; use core::str::FromStr; use num_bigint::BigUint; use sway_ast::expr::asm::{ AsmBlock, AsmBlockContents, AsmFinalExpr, AsmImmediate, AsmRegisterDeclaration, }; use sway_error::parser_error::ParseErrorK...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/expr/op_code.rs
sway-parse/src/expr/op_code.rs
use crate::{ParseResult, Parser}; use sway_ast::expr::op_code::*; use sway_error::parser_error::ParseErrorKind; use sway_types::{Ident, Spanned}; macro_rules! define_op_codes ( ( $(($op_name:ident, $ty_name:ident, $s:literal, ($($arg_name:ident),*)),)* ) => { pub const OP_CODES: &'static [&'static str] = ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/expr/mod.rs
sway-parse/src/expr/mod.rs
use crate::{Parse, ParseBracket, ParseResult, ParseToEnd, Parser, ParserConsumed, Peek}; use sway_ast::brackets::{Braces, Parens, SquareBrackets}; use sway_ast::expr::{LoopControlFlow, ReassignmentOp, ReassignmentOpVariant}; use sway_ast::keywords::{ AbiToken, AddEqToken, AmpersandToken, AsmToken, CommaToken, Conf...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/ty/mod.rs
sway-parse/src/ty/mod.rs
use crate::{Parse, ParseBracket, ParseResult, ParseToEnd, Parser, ParserConsumed}; use sway_ast::brackets::{Parens, SquareBrackets}; use sway_ast::keywords::{DoubleColonToken, OpenAngleBracketToken, PtrToken, SliceToken, StrToken}; use sway_ast::ty::{Ty, TyArrayDescriptor, TyTupleDescriptor}; use sway_ast::{Expr, Liter...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_abi.rs
sway-parse/src/item/item_abi.rs
use crate::{Parse, ParseBracket, ParseResult, Parser}; use sway_ast::attribute::Annotated; use sway_ast::{Braces, ItemAbi, ItemFn, ItemTraitItem}; impl Parse for ItemAbi { fn parse(parser: &mut Parser) -> ParseResult<ItemAbi> { let abi_token = parser.parse()?; let name = parser.parse()?; l...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_storage.rs
sway-parse/src/item/item_storage.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::{ attribute::Annotated, keywords::{ColonToken, InToken}, Braces, CommaToken, Expr, ItemStorage, Punctuated, StorageEntry, StorageField, }; use sway_types::BaseIdent; impl Parse for StorageEntry { fn parse(parser: &mut Parser) -> ParseResult<Storag...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_enum.rs
sway-parse/src/item/item_enum.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::keywords::{OpenAngleBracketToken, WhereToken}; use sway_ast::ItemEnum; impl Parse for ItemEnum { fn parse(parser: &mut Parser) -> ParseResult<ItemEnum> { Ok(ItemEnum { visibility: parser.take(), enum_token: parser.parse()?, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_type_alias.rs
sway-parse/src/item/item_type_alias.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::ItemTypeAlias; impl Parse for ItemTypeAlias { fn parse(parser: &mut Parser) -> ParseResult<ItemTypeAlias> { let visibility = parser.take(); let type_token = parser.parse()?; let name = parser.parse()?; let eq_token = parser.par...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_const.rs
sway-parse/src/item/item_const.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::ItemConst; impl Parse for ItemConst { fn parse(parser: &mut Parser) -> ParseResult<ItemConst> { let pub_token = parser.take(); let const_token = parser.parse()?; let name = parser.parse()?; let ty_opt = match parser.take() { ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_configurable.rs
sway-parse/src/item/item_configurable.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::{ConfigurableField, ItemConfigurable}; impl Parse for ConfigurableField { fn parse(parser: &mut Parser) -> ParseResult<ConfigurableField> { let name = parser.parse()?; let colon_token = parser.parse()?; let ty = parser.parse()?; ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_struct.rs
sway-parse/src/item/item_struct.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::keywords::{ClassToken, Keyword, OpenAngleBracketToken, StructToken, WhereToken}; use sway_ast::ItemStruct; use sway_error::parser_error::ParseErrorKind; use sway_types::Spanned; impl Parse for ItemStruct { fn parse(parser: &mut Parser) -> ParseResult<ItemStru...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/mod.rs
sway-parse/src/item/mod.rs
use crate::{Parse, ParseResult, ParseToEnd, Parser, ParserConsumed}; use sway_ast::keywords::{ AbiToken, ClassToken, ColonToken, ConfigurableToken, ConstToken, EnumToken, FnToken, ImplToken, ModToken, MutToken, OpenAngleBracketToken, RefToken, SelfToken, SemicolonToken, StorageToken, StructToken, TraitToke...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_trait.rs
sway-parse/src/item/item_trait.rs
use crate::{Parse, ParseBracket, ParseResult, Parser}; use sway_ast::attribute::Annotated; use sway_ast::keywords::{ConstToken, FnToken, OpenAngleBracketToken, TypeToken, WhereToken}; use sway_ast::{Braces, ItemFn, ItemTrait, ItemTraitItem, PubToken, Traits}; use sway_error::parser_error::ParseErrorKind; impl Parse f...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_use.rs
sway-parse/src/item/item_use.rs
use crate::{Parse, ParseBracket, ParseResult, Parser}; use sway_ast::{Braces, ItemUse, UseTree}; use sway_error::parser_error::ParseErrorKind; use sway_types::Spanned; impl Parse for UseTree { fn parse(parser: &mut Parser) -> ParseResult<UseTree> { if let Some(imports) = Braces::try_parse(parser)? { ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_impl.rs
sway-parse/src/item/item_impl.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::attribute::Annotated; use sway_ast::keywords::{ ConstToken, FnToken, OpenAngleBracketToken, SemicolonToken, TypeToken, WhereToken, }; use sway_ast::{Braces, GenericParams, ItemImpl, ItemImplItem, PubToken, Ty}; use sway_error::parser_error::ParseErrorKind; im...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/src/item/item_fn.rs
sway-parse/src/item/item_fn.rs
use crate::{Parse, ParseResult, Parser}; use sway_ast::ItemFn; impl Parse for ItemFn { fn parse(parser: &mut Parser) -> ParseResult<ItemFn> { let fn_signature = parser.parse()?; let body = parser.parse()?; Ok(ItemFn { fn_signature, body }) } }
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/tests/noop_script.rs
sway-parse/tests/noop_script.rs
use insta::*; use crate::common::parse_file; mod common; #[test] fn noop_script_file() { assert_ron_snapshot!(parse_file(r#" script; fn main() { () } "#,), @r#" Some(Annotated( attributes: [], value: Module( kind: Script( script_token: Script...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-parse/tests/common/mod.rs
sway-parse/tests/common/mod.rs
use sway_ast::{attribute::Annotated, Module}; use sway_features::ExperimentalFeatures; use sway_parse::parse_file as sway_parse_parse_file; pub fn parse_file(src: &str) -> Option<Annotated<Module>> { let handler = <_>::default(); let path = None; sway_parse_parse_file(&handler, src.into(), path, Experiment...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/lib.rs
forc-pkg/src/lib.rs
//! Building, locking, fetching and updating sway projects as Forc packages. //! //! A forc package represents a Sway project with a `Forc.toml` manifest file declared at its root. //! The project should consist of one or more Sway modules under a `src` directory. It may also //! declare a set of forc package dependenc...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/lock.rs
forc-pkg/src/lock.rs
use crate::{pkg, source, DepKind, Edge}; use anyhow::{anyhow, Result}; use forc_tracing::{println_action_green, println_action_red}; use petgraph::{visit::EdgeRef, Direction}; use serde::{Deserialize, Serialize}; use std::{ borrow::Cow, collections::{BTreeSet, HashMap, HashSet}, fs, path::Path, str:...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/pkg.rs
forc-pkg/src/pkg.rs
use crate::manifest::GenericManifestFile; use crate::{ lock::Lock, manifest::{Dependency, ManifestFile, MemberManifestFiles, PackageManifestFile}, source::{self, IPFSNode, Source}, BuildProfile, }; use anyhow::{anyhow, bail, Context, Error, Result}; use byte_unit::{Byte, UnitType}; use forc_tracing::{pr...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/path.rs
forc-pkg/src/source/path.rs
use crate::manifest::GenericManifestFile; use crate::{manifest::PackageManifestFile, pkg::PinnedId, source}; use serde::{Deserialize, Serialize}; use std::{ fmt, path::{Path, PathBuf}, str::FromStr, }; /// A path to a directory with a `Forc.toml` manifest at its root. pub type Source = PathBuf; /// A pinn...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/mod.rs
forc-pkg/src/source/mod.rs
//! Related to pinning, fetching, validating and caching the source for packages. //! //! To add a new source kind: //! //! 1. Add a new module. //! 2. Create types providing implementations for each of the traits in this module. //! 3. Add a variant to the `Source` and `Pinned` types in this module. //! 4. Add variant...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/ipfs.rs
forc-pkg/src/source/ipfs.rs
use crate::manifest::GenericManifestFile; use crate::{ manifest::{self, PackageManifestFile}, source, }; use anyhow::Result; use flate2::read::GzDecoder; use forc_tracing::println_action_green; use futures::TryStreamExt; use ipfs_api::IpfsApi; use ipfs_api_backend_hyper as ipfs_api; use serde::{Deserialize, Des...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/member.rs
forc-pkg/src/source/member.rs
use crate::manifest::GenericManifestFile; use crate::{manifest::PackageManifestFile, source}; use serde::{Deserialize, Serialize}; use std::{ fmt, path::{Path, PathBuf}, }; /// Member source representation as a canonical path. #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/reg/index_file.rs
forc-pkg/src/source/reg/index_file.rs
//! This module handles everything to do with index files. //! //! Index files are for creating set of information for identifying a published //! package. They are used by forc while fetching to actually convert a registry //! index into a IPFS CID. We also add some metadata to this index files to //! enable forc to d...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/reg/mod.rs
forc-pkg/src/source/reg/mod.rs
pub mod file_location; pub mod index_file; use super::IPFSNode; use crate::{ manifest::{self, GenericManifestFile, PackageManifestFile}, source::{ self, ipfs::{ipfs_client, Cid}, }, }; use anyhow::{anyhow, bail, Context}; use file_location::{location_from_root, Namespace}; use flate2::read:...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/reg/file_location.rs
forc-pkg/src/source/reg/file_location.rs
use serde::{Deserialize, Serialize}; use std::{fmt::Display, path::PathBuf}; /// Number of levels of nesting to use for file locations. const NESTING_LEVELS: usize = 2; #[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)] pub enum Namespace { /// Flat namespace means no sub-namesp...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/git/auth.rs
forc-pkg/src/source/git/auth.rs
/// Handler holds all required information for handling authentication callbacks from `git2`. pub(crate) struct AuthHandler { config: git2::Config, /// Shows if the `AuthHandler` tried to make `SSH` authentication so far. ssh_authentication_attempt: bool, /// Shows if the `AuthHandler` tried to make `US...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/source/git/mod.rs
forc-pkg/src/source/git/mod.rs
mod auth; use crate::manifest::GenericManifestFile; use crate::{ manifest::{self, PackageManifestFile}, source, }; use anyhow::{anyhow, bail, Context, Result}; use forc_tracing::println_action_green; use forc_util::git_checkouts_directory; use serde::{Deserialize, Serialize}; use std::fmt::Display; use std::{ ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/manifest/dep_modifier.rs
forc-pkg/src/manifest/dep_modifier.rs
use crate::manifest::{ ContractDependency, Dependency, DependencyDetails, GenericManifestFile, HexSalt, }; use crate::source::IPFSNode; use crate::{self as pkg, Lock, PackageManifestFile}; use anyhow::{anyhow, bail, Result}; use pkg::manifest::ManifestFile; use std::collections::BTreeMap; use std::fmt; use std::pat...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/manifest/build_profile.rs
forc-pkg/src/manifest/build_profile.rs
use serde::{Deserialize, Serialize}; use sway_core::{Backtrace, IrCli, OptLevel, PrintAsm}; use crate::DumpOpts; /// Parameters to pass through to the `sway_core::BuildConfig` during compilation. #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] #[serde(rename_all = "kebab-case")] pub struct BuildProfile...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/forc-pkg/src/manifest/mod.rs
forc-pkg/src/manifest/mod.rs
pub mod build_profile; pub mod dep_modifier; use crate::pkg::{manifest_file_missing, parsing_failed, wrong_program_type}; use anyhow::{anyhow, bail, Context, Result}; use forc_tracing::println_warning; use forc_util::{validate_name, validate_project_name}; use semver::Version; use serde::{de, Deserialize, Serialize}; ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/convert_parse_tree_error.rs
sway-error/src/convert_parse_tree_error.rs
use sway_types::{Ident, IdentUnique, Span, Spanned}; use thiserror::Error; use crate::formatting::{ a_or_an, num_to_str, num_to_str_or_none, plural_s, sequence_to_str, Enclosing, }; #[derive(Error, Debug, Clone, PartialEq, Eq, Hash)] pub enum ConvertParseTreeError { #[error("Imports without items are not supp...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/lib.rs
sway-error/src/lib.rs
pub mod convert_parse_tree_error; pub mod diagnostic; pub mod error; pub mod formatting; pub mod handler; pub mod lex_error; pub mod parser_error; pub mod type_error; pub mod warning;
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/type_error.rs
sway-error/src/type_error.rs
use sway_types::{Span, Spanned}; use thiserror::Error; #[derive(Error, Debug, Clone, PartialEq, Eq, Hash)] pub enum TypeError { #[error( "Mismatched types.\n\ expected: {expected}\n\ found: {received}.\n\ {help}", help = if !help_text.is_empty() { format!("help: {help...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/warning.rs
sway-error/src/warning.rs
use crate::{ diagnostic::{Code, Diagnostic, Hint, Issue, Reason, ToDiagnostic}, formatting::{ did_you_mean_help, first_line, num_to_str, sequence_to_list, sequence_to_str, Enclosing, Indent, }, }; use core::fmt; use either::Either; use sway_types::{Ident, IdentUnique, SourceId, Span, Span...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/lex_error.rs
sway-error/src/lex_error.rs
use sway_types::{ast::Delimiter, Ident, Span, Spanned}; use thiserror::Error; #[derive(Error, Debug, Clone, PartialEq, Eq, PartialOrd, Hash)] #[error("{}", kind)] pub struct LexError { pub span: Span, pub kind: LexErrorKind, } #[derive(Error, Debug, Clone, PartialEq, Eq, PartialOrd, Hash)] pub enum LexErrorKi...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/error.rs
sway-error/src/error.rs
use crate::convert_parse_tree_error::{ get_attribute_type, get_expected_attributes_args_multiplicity_msg, AttributeType, ConvertParseTreeError, }; use crate::diagnostic::{Code, Diagnostic, Hint, Issue, Reason, ToDiagnostic}; use crate::formatting::*; use crate::lex_error::LexError; use crate::parser_error::{Par...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
true
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/handler.rs
sway-error/src/handler.rs
use crate::{ error::CompileError, warning::{CompileInfo, CompileWarning}, }; use core::cell::RefCell; /// A handler with which you can emit diagnostics. #[derive(Default, Debug, Clone)] pub struct Handler { /// The inner handler. /// This construction is used to avoid `&mut` all over the compiler. ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/formatting.rs
sway-error/src/formatting.rs
//! This module contains various helper functions for easier formatting and creation of user-friendly messages. use std::{ borrow::Cow, cmp::{self, Ordering}, fmt::{self, Display}, }; use sway_types::{SourceEngine, SourceId, Span}; use crate::diagnostic::Hint; /// Returns the file name (with extension) ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/parser_error.rs
sway-error/src/parser_error.rs
use sway_types::ast::PunctKind; use sway_types::{Ident, Span}; use thiserror::Error; #[derive(Debug, Error, Clone, PartialEq, Eq, Hash)] pub enum ParseErrorKind { #[error("Expected an import name, group of imports, or `*`.")] ExpectedImportNameGroupOrGlob, #[error("Expected an item.")] ExpectedAnItem, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-error/src/diagnostic.rs
sway-error/src/diagnostic.rs
use std::{path::PathBuf, vec}; use sway_types::{SourceEngine, Span}; /// Provides detailed, rich description of a compile error or warning. #[derive(Debug, Default)] pub struct Diagnostic { pub reason: Option<Reason>, // TODO: Make mandatory once we remove all old-style warnings and errors. pub issue: Issue, ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/attribute.rs
sway-ast/src/attribute.rs
use crate::priv_prelude::*; #[derive(Clone, Debug, Serialize)] pub struct Annotated<T> { pub attributes: Vec<AttributeDecl>, pub value: T, } // Storage access and purity. pub const STORAGE_ATTRIBUTE_NAME: &str = "storage"; pub const STORAGE_READ_ARG_NAME: &str = "read"; pub const STORAGE_WRITE_ARG_NAME: &str ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/path.rs
sway-ast/src/path.rs
use crate::priv_prelude::*; #[derive(Clone, Debug, Serialize)] pub struct PathExpr { pub root_opt: Option<(Option<AngleBrackets<QualifiedPathRoot>>, DoubleColonToken)>, pub prefix: PathExprSegment, pub suffix: Vec<(DoubleColonToken, PathExprSegment)>, // path expression with incomplete suffix are neede...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/lib.rs
sway-ast/src/lib.rs
pub mod assignable; pub mod attribute; pub mod brackets; pub mod expr; pub mod generics; pub mod intrinsics; mod item; pub mod keywords; pub mod literal; pub mod module; pub mod path; pub mod pattern; mod priv_prelude; pub mod punctuated; pub mod statement; pub mod submodule; pub mod token; pub mod ty; pub mod where_cl...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/pattern.rs
sway-ast/src/pattern.rs
use sway_error::handler::ErrorEmitted; use crate::priv_prelude::*; #[derive(Clone, Debug, Serialize)] pub enum Pattern { Or { lhs: Box<Pattern>, pipe_token: PipeToken, rhs: Box<Pattern>, }, Wildcard { underscore_token: UnderscoreToken, }, /// A pattern made of a sin...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/where_clause.rs
sway-ast/src/where_clause.rs
use crate::priv_prelude::*; #[derive(Clone, Debug, Serialize)] pub struct WhereClause { pub where_token: WhereToken, pub bounds: Punctuated<WhereBound, CommaToken>, } #[derive(Clone, Debug, Serialize)] pub struct WhereBound { pub ty_name: Ident, pub colon_token: ColonToken, pub bounds: Traits, } ...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/module.rs
sway-ast/src/module.rs
use sway_types::SourceId; use crate::priv_prelude::*; #[derive(Clone, Debug, Serialize)] pub struct Module { pub kind: ModuleKind, pub semicolon_token: SemicolonToken, pub items: Vec<Item>, } impl Module { pub fn submodules(&self) -> impl Iterator<Item = &Submodule> { self.items.iter().filter...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false
FuelLabs/sway
https://github.com/FuelLabs/sway/blob/cc8f867043f3ec2c14ec4088d449cde603929a80/sway-ast/src/priv_prelude.rs
sway-ast/src/priv_prelude.rs
pub use { crate::{ assignable::Assignable, attribute::Annotated, brackets::{AngleBrackets, Braces, Parens, SquareBrackets}, expr::{ asm::{AsmBlock, AsmImmediate}, op_code::Instruction, CodeBlockContents, Expr, }, generics::{GenericA...
rust
Apache-2.0
cc8f867043f3ec2c14ec4088d449cde603929a80
2026-01-04T15:31:58.694488Z
false