Struct shredder::DerefGc [−][src]
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!
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
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
Auto Trait Implementations
impl<T> !RefUnwindSafe for DerefGc<T>
impl<T> !UnwindSafe for DerefGc<T>
Blanket Implementations
Mutably borrows from an owned value. Read more
The equivalent of Access::load
.