Class: Farce::LazyRef
- Inherits:
-
Reference
- Object
- Reference
- Farce::LazyRef
- Defined in:
- lib/farce/lazy_ref.rb
Overview
Instance Method Summary collapse
-
#initialize ⇒ LazyRef
constructor
Valid modes are: *
:copy- The value will be copied between Ractors.
Constructor Details
#initialize(factory, mode: :copy) ⇒ LazyRef #initialize(self: nil, mode: :copy) { ... } ⇒ LazyRef
Valid modes are:
:copy- The value will be copied between Ractors. This is the default mode.:make_shareable- The value will be made Ractor-shareable using Ractor.make_shareable.:move- The value will be moved between Ractors. This saves memory compared to copying, and supports values that can't be copied but moved (like IO objects). However, the value will no longer be accessible on the Ractor that pushed it.:mutable- A Mutable instance will be created for the value. This isn't done recursively and thus will fail for nested unshareable values.:local- The value will be kept local to the Ractor that pushed it. Another ractor trying to receive it will get an error. Useful for usage contained within a single Ractor.:proxy- The value will be wrapped in aFarce::Proxythat executes calls in the original Ractor.:raise- An error will be raised if the value is not Ractor-shareable. Useful for enforcing shareability.:dedup- The value will be deduplicated using Farce.dedup, then made Ractor-shareable. This may update and freeze the original. Already-shareable values pass through unchanged.:shareable_copy- The value will be copied and the copy will be made Ractor-shareable.
39 |
# File 'lib/farce/lazy_ref.rb', line 39 LazyRef = Reference[Lazy] |