doc updates

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-12-16 14:06:31 +01:00
parent e5a46a38ef
commit 020bb8f6d9
2 changed files with 5 additions and 0 deletions

View File

@ -1,3 +1,5 @@
//! Error types.
use std::fmt;
/// Error returned by `TryFrom` implementations between `Scalar`, `Array` and `Hash`.

View File

@ -175,6 +175,7 @@ impl Value {
self.bless_sv(&pkgsv)
}
/// Same as [`bless`] but the package string is already a perl [`ScalarRef`].
pub fn bless_sv(&self, pkgsv: &ScalarRef) -> Result<Value, Error> {
let stash = unsafe { ffi::RSPL_gv_stashsv(pkgsv.sv(), 0) };
if stash.is_null() {
@ -218,6 +219,7 @@ impl Value {
Self::from_scalar(Scalar::from_raw_ref(ptr as *mut SV))
}
/// Convert a [`Scalar`] to a [`Value`].
pub fn from_scalar(scalar: Scalar) -> Self {
Self::from(scalar)
}
@ -250,6 +252,7 @@ impl Value {
}
}
/// Turn this into a "mortal" value in perl.
pub fn into_mortal(self) -> crate::scalar::Mortal {
match self {
Value::Scalar(v) => v.into_mortal(),