I want to find out if a resource passed as a bucket to my method is a Fungible or non fungible resource (the action is different in each case)
I tried this:
let resource_man = bucket.resource_manager();
match resource_man.resource_type() {
ResourceType::NonmFungible => {//do something here}
ResourceType::Fungible => {//do another here}
}
But I get this error:
error[E0533]: expected unit struct, unit variant or constant, found struct variant 'ResourceType::NonFungible'
How to work around this and getthe flow control I want?
This should work:
The types have their own fields which you have to match on: https://radixdlt.github.io/radixdlt-scrypto/scrypto/blueprints/resource/enum.ResourceType.html. The
..ignores these fields (I'm assuming you don't care about them).Edit: to elaborate a bit more.. you could match on divisibility, for example: