Skip to main content

PerlValue

Struct PerlValue 

Source
pub struct PerlValue(/* private fields */);
Expand description

NaN-boxed value: one u64 (immediates, raw float bits, or tagged heap pointer).

Implementations§

Source§

impl PerlValue

Source

pub fn dup_stack(&self) -> Self

Stack duplicate (Op::Dup): share the outer heap Arc for arrays/hashes (COW on write), matching Perl temporaries; other heap payloads keep Clone semantics.

Source

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

Source

pub const UNDEF: PerlValue

Source

pub fn is_integer_like(&self) -> bool

typed : Int — inline i32 or heap i64.

Source

pub fn is_float_like(&self) -> bool

Raw f64 bits or heap boxed float (NaN/Inf).

Source

pub fn is_string_like(&self) -> bool

Heap UTF-8 string only.

Source

pub fn integer(n: i64) -> Self

Source

pub fn float(f: f64) -> Self

Source

pub fn string(s: String) -> Self

Source

pub fn bytes(b: Arc<Vec<u8>>) -> Self

Source

pub fn array(v: Vec<PerlValue>) -> Self

Source

pub fn iterator(it: Arc<dyn PerlIterator>) -> Self

Wrap a lazy iterator as a PerlValue.

Source

pub fn is_iterator(&self) -> bool

True when this value is a lazy iterator.

Source

pub fn into_iterator(&self) -> Arc<dyn PerlIterator>

Extract the iterator Arc (panics if not an iterator).

Source

pub fn hash(h: IndexMap<String, PerlValue>) -> Self

Source

pub fn array_ref(a: Arc<RwLock<Vec<PerlValue>>>) -> Self

Source

pub fn hash_ref(h: Arc<RwLock<IndexMap<String, PerlValue>>>) -> Self

Source

pub fn scalar_ref(r: Arc<RwLock<PerlValue>>) -> Self

Source

pub fn capture_cell(r: Arc<RwLock<PerlValue>>) -> Self

Source

pub fn scalar_binding_ref(name: String) -> Self

Source

pub fn array_binding_ref(name: String) -> Self

Source

pub fn hash_binding_ref(name: String) -> Self

Source

pub fn code_ref(c: Arc<PerlSub>) -> Self

Source

pub fn as_code_ref(&self) -> Option<Arc<PerlSub>>

Source

pub fn as_regex(&self) -> Option<Arc<PerlCompiledRegex>>

Source

pub fn as_blessed_ref(&self) -> Option<Arc<BlessedRef>>

Source

pub fn hash_get(&self, key: &str) -> Option<PerlValue>

Hash lookup when this value is a plain HeapObject::Hash (not a ref).

Source

pub fn is_undef(&self) -> bool

Source

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.

Source

pub fn as_integer(&self) -> Option<i64>

Immediate int32 or heap Integer (not float / string).

Source

pub fn as_float(&self) -> Option<f64>

Source

pub fn as_array_vec(&self) -> Option<Vec<PerlValue>>

Source

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).

Source

pub fn as_hash_map(&self) -> Option<IndexMap<String, PerlValue>>

Source

pub fn as_bytes_arc(&self) -> Option<Arc<Vec<u8>>>

Source

pub fn as_async_task(&self) -> Option<Arc<PerlAsyncTask>>

Source

pub fn as_generator(&self) -> Option<Arc<PerlGenerator>>

Source

pub fn as_atomic_arc(&self) -> Option<Arc<Mutex<PerlValue>>>

Source

pub fn as_io_handle_name(&self) -> Option<String>

Source

pub fn as_sqlite_conn(&self) -> Option<Arc<Mutex<Connection>>>

Source

pub fn as_struct_inst(&self) -> Option<Arc<StructInstance>>

Source

pub fn as_enum_inst(&self) -> Option<Arc<EnumInstance>>

Source

pub fn as_class_inst(&self) -> Option<Arc<ClassInstance>>

Source

pub fn as_dataframe(&self) -> Option<Arc<Mutex<PerlDataFrame>>>

Source

pub fn as_deque(&self) -> Option<Arc<Mutex<VecDeque<PerlValue>>>>

Source

pub fn as_heap_pq(&self) -> Option<Arc<Mutex<PerlHeap>>>

Source

pub fn as_pipeline(&self) -> Option<Arc<Mutex<PipelineInner>>>

Source

pub fn as_capture(&self) -> Option<Arc<CaptureResult>>

Source

pub fn as_ppool(&self) -> Option<PerlPpool>

Source

pub fn as_remote_cluster(&self) -> Option<Arc<RemoteCluster>>

Source

pub fn as_barrier(&self) -> Option<PerlBarrier>

Source

pub fn as_channel_tx(&self) -> Option<Arc<Sender<PerlValue>>>

Source

pub fn as_channel_rx(&self) -> Option<Arc<Receiver<PerlValue>>>

Source

pub fn as_scalar_ref(&self) -> Option<Arc<RwLock<PerlValue>>>

Source

pub fn as_capture_cell(&self) -> Option<Arc<RwLock<PerlValue>>>

Returns the inner Arc if this is a [HeapObject::CaptureCell].

Source

pub fn as_scalar_binding_name(&self) -> Option<String>

Name of the scalar slot for [HeapObject::ScalarBindingRef], if any.

Source

pub fn as_array_binding_name(&self) -> Option<String>

Stash-qualified array name for [HeapObject::ArrayBindingRef], if any.

Source

pub fn as_hash_binding_name(&self) -> Option<String>

Hash name for [HeapObject::HashBindingRef], if any.

Source

pub fn as_array_ref(&self) -> Option<Arc<RwLock<Vec<PerlValue>>>>

Source

pub fn as_hash_ref(&self) -> Option<Arc<RwLock<IndexMap<String, PerlValue>>>>

Source

pub fn is_mysync_deque_or_heap(&self) -> bool

mysync: deque / priority heap — already Arc<Mutex<…>>.

Source

pub fn regex( rx: Arc<PerlCompiledRegex>, pattern_src: String, flags: String, ) -> Self

Source

pub fn regex_src_and_flags(&self) -> Option<(String, String)>

Pattern and flag string stored with a compiled regex (for =~ / [Op::RegexMatchDyn]).

Source

pub fn blessed(b: Arc<BlessedRef>) -> Self

Source

pub fn io_handle(name: String) -> Self

Source

pub fn atomic(a: Arc<Mutex<PerlValue>>) -> Self

Source

pub fn set(s: Arc<PerlSet>) -> Self

Source

pub fn channel_tx(tx: Arc<Sender<PerlValue>>) -> Self

Source

pub fn channel_rx(rx: Arc<Receiver<PerlValue>>) -> Self

Source

pub fn async_task(t: Arc<PerlAsyncTask>) -> Self

Source

pub fn generator(g: Arc<PerlGenerator>) -> Self

Source

pub fn deque(d: Arc<Mutex<VecDeque<PerlValue>>>) -> Self

Source

pub fn heap(h: Arc<Mutex<PerlHeap>>) -> Self

Source

pub fn pipeline(p: Arc<Mutex<PipelineInner>>) -> Self

Source

pub fn capture(c: Arc<CaptureResult>) -> Self

Source

pub fn ppool(p: PerlPpool) -> Self

Source

pub fn remote_cluster(c: Arc<RemoteCluster>) -> Self

Source

pub fn barrier(b: PerlBarrier) -> Self

Source

pub fn sqlite_conn(c: Arc<Mutex<Connection>>) -> Self

Source

pub fn struct_inst(s: Arc<StructInstance>) -> Self

Source

pub fn enum_inst(e: Arc<EnumInstance>) -> Self

Source

pub fn class_inst(c: Arc<ClassInstance>) -> Self

Source

pub fn dataframe(df: Arc<Mutex<PerlDataFrame>>) -> Self

Source

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.

Source

pub fn as_str(&self) -> Option<String>

Heap string payload, if any (allocates).

Source

pub fn append_to(&self, buf: &mut String)

Source

pub fn unwrap_atomic(&self) -> PerlValue

Source

pub fn is_atomic(&self) -> bool

Source

pub fn is_true(&self) -> bool

Source

pub fn into_string(self) -> String

Source

pub fn as_str_or_empty(&self) -> String

Source

pub fn to_number(&self) -> f64

Source

pub fn to_int(&self) -> i64

Source

pub fn type_name(&self) -> String

Source

pub fn ref_type(&self) -> PerlValue

Source

pub fn num_cmp(&self, other: &PerlValue) -> Ordering

Source

pub fn str_eq(&self, other: &PerlValue) -> bool

String equality for eq / cmp without allocating when both sides are heap strings.

Source

pub fn str_cmp(&self, other: &PerlValue) -> Ordering

Source

pub fn struct_field_eq(&self, other: &PerlValue) -> bool

Deep equality for struct fields (recursive).

Source

pub fn deep_clone(&self) -> PerlValue

Deep clone a value (used for struct clone).

Source

pub fn to_list(&self) -> Vec<PerlValue>

Source

pub fn scalar_context(&self) -> PerlValue

Trait Implementations§

Source§

impl Clone for PerlValue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PerlValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PerlValue

Source§

fn default() -> Self

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

impl Display for PerlValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for PerlValue

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more