Skip to main content

ExDuplicateResource

Struct ExDuplicateResource 

pub struct ExDuplicateResource<'a, T>
where T: Inherits<Resource>,
{ /* private fields */ }
Expand description

Builder for duplicating a resource with deep duplication control.

Created by Gd::duplicate_resource_ex(). See that method for details and version-specific behavior.

Configuration methods:

Terminal methods:

  • done(): Finalize duplication (panics on failure).
  • done_or_null(): Finalize duplication (returns Result).

Implementations§

§

impl<'a, T> ExDuplicateResource<'a, T>
where T: Inherits<Resource>,

pub fn deep_internal(self) -> ExDuplicateResource<'a, T>

Deep duplication of internal subresources (Godot 4.3+).

Duplicates subresources that have no external path (embedded/internal resources).

§Compatibility

In Godot 4.2-4.4, subresources inside Array/Dictionary properties are not duplicated (known Godot bug). This was fixed in Godot 4.5, from which version onward this is equivalent to deep(DeepDuplicateMode::INTERNAL).

pub fn deep(self, subresources: DeepDuplicateMode) -> ExDuplicateResource<'a, T>

Available on since_api=4.5 only.

Deep duplication with control over subresources (Godot 4.5+).

The subresources parameter controls which Resource objects are duplicated:

  • NONE: No subresources duplicated (but Array/Dictionary containers are deep-copied).
  • INTERNAL: Duplicates internal subresources only (no external path). Same as deep_internal().
  • ALL: Duplicates all subresources.

Note: Unlike done() without deep(), this method always deep-copies Array/Dictionary containers. The subresources mode only controls whether Resource objects inside them are duplicated or shared.

§Compatibility

Requires Godot 4.5, as it uses Godot’s new Resource::duplicate_deep() API.

pub fn done(self) -> Gd<T>

Complete the duplication and return the duplicated resource.

§Panics

On errors, see Gd::duplicate_resource_ex(). To check for results, use done_or_null().

pub fn done_or_null(self) -> Option<Gd<T>>

Complete the duplication and return the duplicated resource, or None if it fails.

See Gd::duplicate_resource_ex() for details.

Auto Trait Implementations§

§

impl<'a, T> Freeze for ExDuplicateResource<'a, T>

§

impl<'a, T> RefUnwindSafe for ExDuplicateResource<'a, T>

§

impl<'a, T> !Send for ExDuplicateResource<'a, T>

§

impl<'a, T> !Sync for ExDuplicateResource<'a, T>

§

impl<'a, T> Unpin for ExDuplicateResource<'a, T>

§

impl<'a, T> UnsafeUnpin for ExDuplicateResource<'a, T>

§

impl<'a, T> UnwindSafe for ExDuplicateResource<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.