pub struct Av(/* private fields */);Implementations§
Source§impl Av
impl Av
Sourcepub fn push(&self, perl: &Perl, sv: Sv)
pub fn push(&self, perl: &Perl, sv: Sv)
Append sv to the end of the array. The Sv is refcount-inc’d
before being handed to av_push because av_push takes
ownership of one ref — and the caller’s mortal Sv would
otherwise be freed at scope exit, leaving a dangling slot.
Sourcepub fn into_rv(self, perl: &Perl) -> Rv<Av>
pub fn into_rv(self, perl: &Perl) -> Rv<Av>
Wrap this AV in a fresh mortal RV (\@array in Perl). The
returned Rv<Av> is the value you typically push to the Perl
stack as the XS sub’s return.
Sourcepub unsafe fn from_raw_unchecked(p: *mut AV) -> Av
pub unsafe fn from_raw_unchecked(p: *mut AV) -> Av
Wrap a raw *mut AV without checking for null. Used by the
#[xs_sub] proc-macro after it has dereferenced an &Av arg
(caller passed \@arr and we’ve already SvROK / SvTYPE-checked
the SV).
§Safety
p must be non-null and point to a valid AV that outlives the
returned Av.
Sourcepub fn get(&self, perl: &Perl, idx: usize) -> Option<Sv>
pub fn get(&self, perl: &Perl, idx: usize) -> Option<Sv>
$arr[$idx], or None if the slot is empty / out of bounds.
The returned Sv borrows from this AV — don’t keep it past
any mutation of the AV.