Struct Rc

Helper struct that manages the reference count of an object using RAII.

struct Rc(T)
  
if (isAtomicRefCounted!T);

Constructors

NameDescription
this (obj) Build a Rc instance with the provided resource

Fields

NameTypeDescription
_obj T

Properties

NameTypeDescription
loaded[get] boolCheck whether this Rc is assigned to a resource.
obj[get] inout(T)Access to the held resource.

Methods

NameDescription
giveAway () Decrease the ref count and return the object without calling dispose
opAssign (obj) Assign another resource. Release the previously held ref and retain the new one.
opCast () Check whether this Rc is assigned to a resource.
unload () Reset the resource.