How to get uid based on Address and AssetId

Hi guys, I’m trying to create uid based on Address and AssetId in the indexer lib file, it works well like uid(event.address) and uid(event.asset_id.0) but how to make it together?

I’m trying to store data like this:

storage {
    user_collateral: StorageMap<(Address, AssetId), u64> = StorageMap {},
}

Toolchain latest and indexer v0.20.8

Default host: aarch64-apple-darwin
fuelup home: /Users/alexey/.fuelup

installed toolchains
--------------------
beta-3-aarch64-apple-darwin
beta-4-rc.2-aarch64-apple-darwin
latest-aarch64-apple-darwin (default)
hotfix
my-custom-toolchain

active toolchain
-----------------
latest-aarch64-apple-darwin (default)
  forc : 0.44.1
    - forc-client
      - forc-deploy : 0.44.1
      - forc-run : 0.44.1
    - forc-doc : 0.44.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.44.1
    - forc-index : 0.20.8
    - forc-lsp : 0.44.1
    - forc-tx : 0.44.1
    - forc-wallet : 0.3.0
  fuel-core : 0.20.4
  fuel-core-keygen : Error getting version string
  fuel-indexer : 0.20.8

fuels versions
---------------
forc : 0.45
forc-wallet : 0.45

Source code

The uid function expects a contiguous slice of bytes.

The following is not a valid way to join two separate byte arrays together in rust, as it just creates a slice of two nested slices:

[..event.address, ..event.asset_id.0]

To create a flattened byte slice from two separate slices you’ll need to concat them.

Playground example → Rust Playground

Oh, sorry, stupid question, that works for me :sparkles: