pub struct ResourceBuilder;
Expand description
Utility for setting up a new resource.
- You start the building process with one of the methods starting with
new_
. - The allowed methods change depending on which methods have already been called. For example,
you can either use
owner_non_fungible_badge
or set access rules individually, but not both. - You can complete the building process using either
create_with_no_initial_supply()
ormint_initial_supply(..)
.
§Example
use scrypto_test::prelude::*;
let mut env = TestEnvironment::new();
let bucket = ResourceBuilder::new_fungible(OwnerRole::None)
.mint_initial_supply(5, &mut env);
Implementations§
Source§impl ResourceBuilder
impl ResourceBuilder
Sourcepub fn new_fungible(
owner_role: OwnerRole,
) -> InProgressResourceBuilder<FungibleResourceType>
pub fn new_fungible( owner_role: OwnerRole, ) -> InProgressResourceBuilder<FungibleResourceType>
Starts a new builder to create a fungible resource.
Sourcepub fn new_string_non_fungible<D: NonFungibleData>(
owner_role: OwnerRole,
) -> InProgressResourceBuilder<NonFungibleResourceType<StringNonFungibleLocalId, D>>
pub fn new_string_non_fungible<D: NonFungibleData>( owner_role: OwnerRole, ) -> InProgressResourceBuilder<NonFungibleResourceType<StringNonFungibleLocalId, D>>
Starts a new builder to create a non-fungible resource with a NonFungibleIdType::String
Sourcepub fn new_integer_non_fungible<D: NonFungibleData>(
owner_role: OwnerRole,
) -> InProgressResourceBuilder<NonFungibleResourceType<IntegerNonFungibleLocalId, D>>
pub fn new_integer_non_fungible<D: NonFungibleData>( owner_role: OwnerRole, ) -> InProgressResourceBuilder<NonFungibleResourceType<IntegerNonFungibleLocalId, D>>
Starts a new builder to create a non-fungible resource with a NonFungibleIdType::Integer
Sourcepub fn new_bytes_non_fungible<D: NonFungibleData>(
owner_role: OwnerRole,
) -> InProgressResourceBuilder<NonFungibleResourceType<BytesNonFungibleLocalId, D>>
pub fn new_bytes_non_fungible<D: NonFungibleData>( owner_role: OwnerRole, ) -> InProgressResourceBuilder<NonFungibleResourceType<BytesNonFungibleLocalId, D>>
Starts a new builder to create a non-fungible resource with a NonFungibleIdType::Bytes
Sourcepub fn new_ruid_non_fungible<D: NonFungibleData>(
owner_role: OwnerRole,
) -> InProgressResourceBuilder<NonFungibleResourceType<RUIDNonFungibleLocalId, D>>
pub fn new_ruid_non_fungible<D: NonFungibleData>( owner_role: OwnerRole, ) -> InProgressResourceBuilder<NonFungibleResourceType<RUIDNonFungibleLocalId, D>>
Starts a new builder to create a non-fungible resource with a NonFungibleIdType::RUID
Auto Trait Implementations§
impl Freeze for ResourceBuilder
impl RefUnwindSafe for ResourceBuilder
impl Send for ResourceBuilder
impl Sync for ResourceBuilder
impl Unpin for ResourceBuilder
impl UnwindSafe for ResourceBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more