mirror of
https://git.proxmox.com/git/perlmod
synced 2025-10-04 09:08:06 +00:00
make values Clone
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
814014b874
commit
4fe09940a7
@ -11,6 +11,7 @@ use crate::Value;
|
||||
/// An owned reference to a perl array value (AV).
|
||||
///
|
||||
/// This keeps a reference to a value which lives in the perl interpreter.
|
||||
#[derive(Clone)]
|
||||
#[repr(transparent)]
|
||||
pub struct Array(Scalar);
|
||||
|
||||
|
@ -10,6 +10,7 @@ use crate::Value;
|
||||
/// An owned reference to a perl hash value (HV).
|
||||
///
|
||||
/// This keeps a reference to a value which lives in the perl interpreter.
|
||||
#[derive(Clone)]
|
||||
#[repr(transparent)]
|
||||
pub struct Hash(Scalar);
|
||||
|
||||
|
@ -117,6 +117,13 @@ impl Scalar {
|
||||
}
|
||||
}
|
||||
|
||||
impl Clone for Scalar {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
unsafe { Self::from_raw_ref(self.sv()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Scalar {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
@ -12,6 +12,7 @@ use crate::{Array, Hash, Scalar};
|
||||
|
||||
/// A higher level value. This is basically an [`SV`] already cast to [`AV`](crate::ffi::AV) or
|
||||
/// [`HV`](crate::ffi::HV) for arrays and hashes.
|
||||
#[derive(Clone)]
|
||||
pub enum Value {
|
||||
Scalar(Scalar),
|
||||
Reference(Scalar),
|
||||
|
Loading…
Reference in New Issue
Block a user