Struct shredder::DerefGc[][src]

pub struct DerefGc<T: Scan + GcDeref + ?Sized> { /* fields omitted */ }
Expand description

A Gc, but with the ability to Deref to its contents!

This comes with the requirement that your data implement GcDeref, which can be limiting. See GcDeref documentation for details.

Implementations

Create a new DerefGc containing the given data. T: GcDrop in order to create a Gc<T> with this method. If your T is not GcDrop, consider new_with_finalizer.

When this data is garbage collected, its drop implementation will be run.

It is possible for this data not to be collected before the program terminates, or for the program to terminate before the background thread runs its destructor. So be careful when relying on this guarantee.

Create a new DerefGc containing the given data. (But specifying not to run its destructor.) This is useful because T: GcDrop is no longer necessary!

When this data is garbage collected, its drop implementation will NOT be run. Be careful using this method! It can lead to memory leaks!

Create a new DerefGc containing the given data. (But specifying to call finalize on it instead of running its destructor.) This is useful because T: GcDrop is no longer necessary!

As long as finalize does what you think it does, this is probably what you want for non-'static/non-GcDrop data!

It is possible for this data not to be collected before the program terminates, or for the program to terminate before the background thread runs finalize. So be careful!

Create a new DerefGc using the given Box<T>.

This function does not allocate anything - rather, it uses the Box<T> and releases its memory appropriately. This is useful since it removes the requirement for types to be sized.

Attempt to downcast this DerefGc<T> to a DerefGc<S>

For implementation reasons this returns a new DerefGc<T> on success On failure (if there was not an S in the DerefGc<T>) then None is returned

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Do cleanup on this data, potentially leaving it in an invalid state. (See trait documentation for the rules for implementing this method.) Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Formats the value using the given formatter.

scan should use the scanner to scan all of its directly owned data

Auto Trait Implementations

Blanket Implementations

A guard object containing the value and keeping it alive. Read more

The loading method. Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

The equivalent of Access::load.

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.