pub struct PerlValue(/* private fields */);Expand description
NaN-boxed value: one u64 (immediates, raw float bits, or tagged heap pointer).
Implementations§
Source§impl PerlValue
impl PerlValue
Sourcepub fn shallow_clone(&self) -> Self
pub fn shallow_clone(&self) -> Self
Refcount-only clone: Arc::clone the heap pointer (no deep copy of the payload).
Use this when producing a second handle to the same value that the caller
will read-only or consume via Self::into_string / Arc::try_unwrap-style
uniqueness checks. Cheap O(1) regardless of the payload size.
The default Clone impl deep-copies String/Array/Hash payloads to
preserve “clone = independent writable value” semantics for legacy callers;
in hot RMW paths (.=, slot stash-and-return) that deep copy is O(N) and
must be avoided — use this instead.
Source§impl PerlValue
impl PerlValue
pub const UNDEF: PerlValue
Sourcepub fn is_integer_like(&self) -> bool
pub fn is_integer_like(&self) -> bool
typed : Int — inline i32 or heap i64.
Sourcepub fn is_float_like(&self) -> bool
pub fn is_float_like(&self) -> bool
Raw f64 bits or heap boxed float (NaN/Inf).
Sourcepub fn is_string_like(&self) -> bool
pub fn is_string_like(&self) -> bool
Heap UTF-8 string only.
pub fn integer(n: i64) -> Self
pub fn float(f: f64) -> Self
pub fn string(s: String) -> Self
pub fn bytes(b: Arc<Vec<u8>>) -> Self
pub fn array(v: Vec<PerlValue>) -> Self
Sourcepub fn iterator(it: Arc<dyn PerlIterator>) -> Self
pub fn iterator(it: Arc<dyn PerlIterator>) -> Self
Wrap a lazy iterator as a PerlValue.
Sourcepub fn is_iterator(&self) -> bool
pub fn is_iterator(&self) -> bool
True when this value is a lazy iterator.
Sourcepub fn into_iterator(&self) -> Arc<dyn PerlIterator>
pub fn into_iterator(&self) -> Arc<dyn PerlIterator>
Extract the iterator Arc (panics if not an iterator).
pub fn hash(h: IndexMap<String, PerlValue>) -> Self
pub fn array_ref(a: Arc<RwLock<Vec<PerlValue>>>) -> Self
pub fn hash_ref(h: Arc<RwLock<IndexMap<String, PerlValue>>>) -> Self
pub fn scalar_ref(r: Arc<RwLock<PerlValue>>) -> Self
pub fn capture_cell(r: Arc<RwLock<PerlValue>>) -> Self
pub fn scalar_binding_ref(name: String) -> Self
pub fn array_binding_ref(name: String) -> Self
pub fn hash_binding_ref(name: String) -> Self
pub fn code_ref(c: Arc<PerlSub>) -> Self
pub fn as_code_ref(&self) -> Option<Arc<PerlSub>>
pub fn as_regex(&self) -> Option<Arc<PerlCompiledRegex>>
pub fn as_blessed_ref(&self) -> Option<Arc<BlessedRef>>
Sourcepub fn hash_get(&self, key: &str) -> Option<PerlValue>
pub fn hash_get(&self, key: &str) -> Option<PerlValue>
Hash lookup when this value is a plain HeapObject::Hash (not a ref).
pub fn is_undef(&self) -> bool
Sourcepub fn is_simple_scalar(&self) -> bool
pub fn is_simple_scalar(&self) -> bool
True for simple scalar values (integer, float, string, undef, bytes) that should be wrapped in ScalarRef for closure variable sharing. Complex heap objects like refs, blessed objects, code refs, etc. should NOT be wrapped because they already share state via Arc and wrapping breaks type detection.
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Immediate int32 or heap Integer (not float / string).
pub fn as_float(&self) -> Option<f64>
pub fn as_array_vec(&self) -> Option<Vec<PerlValue>>
Sourcepub fn map_flatten_outputs(&self, peel_array_ref: bool) -> Vec<PerlValue>
pub fn map_flatten_outputs(&self, peel_array_ref: bool) -> Vec<PerlValue>
Expand a map / flat_map / pflat_map block result into list elements. Plain arrays
expand; when peel_array_ref, a single ARRAY ref is dereferenced one level (stryke
flat_map / pflat_map; stock map uses peel_array_ref == false).
pub fn as_hash_map(&self) -> Option<IndexMap<String, PerlValue>>
pub fn as_bytes_arc(&self) -> Option<Arc<Vec<u8>>>
pub fn as_async_task(&self) -> Option<Arc<PerlAsyncTask>>
pub fn as_generator(&self) -> Option<Arc<PerlGenerator>>
pub fn as_atomic_arc(&self) -> Option<Arc<Mutex<PerlValue>>>
pub fn as_io_handle_name(&self) -> Option<String>
pub fn as_sqlite_conn(&self) -> Option<Arc<Mutex<Connection>>>
pub fn as_struct_inst(&self) -> Option<Arc<StructInstance>>
pub fn as_enum_inst(&self) -> Option<Arc<EnumInstance>>
pub fn as_class_inst(&self) -> Option<Arc<ClassInstance>>
pub fn as_dataframe(&self) -> Option<Arc<Mutex<PerlDataFrame>>>
pub fn as_deque(&self) -> Option<Arc<Mutex<VecDeque<PerlValue>>>>
pub fn as_heap_pq(&self) -> Option<Arc<Mutex<PerlHeap>>>
pub fn as_pipeline(&self) -> Option<Arc<Mutex<PipelineInner>>>
pub fn as_capture(&self) -> Option<Arc<CaptureResult>>
pub fn as_ppool(&self) -> Option<PerlPpool>
pub fn as_remote_cluster(&self) -> Option<Arc<RemoteCluster>>
pub fn as_barrier(&self) -> Option<PerlBarrier>
pub fn as_channel_tx(&self) -> Option<Arc<Sender<PerlValue>>>
pub fn as_channel_rx(&self) -> Option<Arc<Receiver<PerlValue>>>
pub fn as_scalar_ref(&self) -> Option<Arc<RwLock<PerlValue>>>
Sourcepub fn as_capture_cell(&self) -> Option<Arc<RwLock<PerlValue>>>
pub fn as_capture_cell(&self) -> Option<Arc<RwLock<PerlValue>>>
Returns the inner Arc if this is a [HeapObject::CaptureCell].
Sourcepub fn as_scalar_binding_name(&self) -> Option<String>
pub fn as_scalar_binding_name(&self) -> Option<String>
Name of the scalar slot for [HeapObject::ScalarBindingRef], if any.
Sourcepub fn as_array_binding_name(&self) -> Option<String>
pub fn as_array_binding_name(&self) -> Option<String>
Stash-qualified array name for [HeapObject::ArrayBindingRef], if any.
Sourcepub fn as_hash_binding_name(&self) -> Option<String>
pub fn as_hash_binding_name(&self) -> Option<String>
Hash name for [HeapObject::HashBindingRef], if any.
pub fn as_array_ref(&self) -> Option<Arc<RwLock<Vec<PerlValue>>>>
pub fn as_hash_ref(&self) -> Option<Arc<RwLock<IndexMap<String, PerlValue>>>>
Sourcepub fn is_mysync_deque_or_heap(&self) -> bool
pub fn is_mysync_deque_or_heap(&self) -> bool
mysync: deque / priority heap — already Arc<Mutex<…>>.
pub fn regex( rx: Arc<PerlCompiledRegex>, pattern_src: String, flags: String, ) -> Self
Sourcepub fn regex_src_and_flags(&self) -> Option<(String, String)>
pub fn regex_src_and_flags(&self) -> Option<(String, String)>
Pattern and flag string stored with a compiled regex (for =~ / [Op::RegexMatchDyn]).
pub fn blessed(b: Arc<BlessedRef>) -> Self
pub fn io_handle(name: String) -> Self
pub fn atomic(a: Arc<Mutex<PerlValue>>) -> Self
pub fn set(s: Arc<PerlSet>) -> Self
pub fn channel_tx(tx: Arc<Sender<PerlValue>>) -> Self
pub fn channel_rx(rx: Arc<Receiver<PerlValue>>) -> Self
pub fn async_task(t: Arc<PerlAsyncTask>) -> Self
pub fn generator(g: Arc<PerlGenerator>) -> Self
pub fn deque(d: Arc<Mutex<VecDeque<PerlValue>>>) -> Self
pub fn heap(h: Arc<Mutex<PerlHeap>>) -> Self
pub fn pipeline(p: Arc<Mutex<PipelineInner>>) -> Self
pub fn capture(c: Arc<CaptureResult>) -> Self
pub fn ppool(p: PerlPpool) -> Self
pub fn remote_cluster(c: Arc<RemoteCluster>) -> Self
pub fn barrier(b: PerlBarrier) -> Self
pub fn sqlite_conn(c: Arc<Mutex<Connection>>) -> Self
pub fn struct_inst(s: Arc<StructInstance>) -> Self
pub fn enum_inst(e: Arc<EnumInstance>) -> Self
pub fn class_inst(c: Arc<ClassInstance>) -> Self
pub fn dataframe(df: Arc<Mutex<PerlDataFrame>>) -> Self
Sourcepub fn errno_dual(code: i32, msg: String) -> Self
pub fn errno_dual(code: i32, msg: String) -> Self
OS errno dualvar ($!) or eval-error dualvar ($@): to_int/to_number use code; string context uses msg.
pub fn append_to(&self, buf: &mut String)
pub fn unwrap_atomic(&self) -> PerlValue
pub fn is_atomic(&self) -> bool
pub fn is_true(&self) -> bool
pub fn into_string(self) -> String
pub fn as_str_or_empty(&self) -> String
pub fn to_number(&self) -> f64
pub fn to_int(&self) -> i64
pub fn type_name(&self) -> String
pub fn ref_type(&self) -> PerlValue
pub fn num_cmp(&self, other: &PerlValue) -> Ordering
Sourcepub fn str_eq(&self, other: &PerlValue) -> bool
pub fn str_eq(&self, other: &PerlValue) -> bool
String equality for eq / cmp without allocating when both sides are heap strings.
pub fn str_cmp(&self, other: &PerlValue) -> Ordering
Sourcepub fn struct_field_eq(&self, other: &PerlValue) -> bool
pub fn struct_field_eq(&self, other: &PerlValue) -> bool
Deep equality for struct fields (recursive).
Sourcepub fn deep_clone(&self) -> PerlValue
pub fn deep_clone(&self) -> PerlValue
Deep clone a value (used for struct clone).
pub fn to_list(&self) -> Vec<PerlValue>
pub fn scalar_context(&self) -> PerlValue
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PerlValue
impl RefUnwindSafe for PerlValue
impl Send for PerlValue
impl Sync for PerlValue
impl Unpin for PerlValue
impl UnsafeUnpin for PerlValue
impl UnwindSafe for PerlValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.