doc fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-07-30 15:51:31 +02:00
parent 1adcd9727e
commit 3ddf67eb04
8 changed files with 18 additions and 18 deletions

View File

@ -1,4 +1,4 @@
//! Module dealing with perl [`Array`](crate::Array)s. ([`AV`](crate::ffi::AV) pointers).
//! Module dealing with perl [`Array`]s. ([`AV`] pointers).
use std::marker::PhantomData;
@ -176,7 +176,7 @@ impl std::fmt::Debug for Array {
///
/// Technically the iterator always holds a reference count on the [`AV`] pointer, but we still
/// distinguish between an iterator going over a borrowed [`Array`] and one coming from
/// [`IntoIterator`](std::iter::IntoIterator).
/// [`IntoIterator`].
pub struct Iter<'a> {
array: Array,
at: usize,

View File

@ -13,17 +13,17 @@ use crate::scalar::Type;
use crate::Value;
use crate::{array, ffi, hash};
/// Perl [`Value`](crate::Value) deserializer.
/// Perl [`Value`] deserializer.
struct Deserializer<'de> {
input: Value,
option_allowed: bool,
_lifetime: PhantomData<&'de Value>,
}
/// Deserialize a perl [`Value`](crate::Value).
/// Deserialize a perl [`Value`].
///
/// Note that this causes all the underlying data to be copied recursively, except for other
/// [`Value`](crate::Value) variables, which will be references.
/// [`Value`] variables, which will be references.
pub fn from_value<T>(input: Value) -> Result<T, Error>
where
T: serde::de::DeserializeOwned,
@ -34,11 +34,11 @@ where
Ok(out)
}
/// Deserialize a reference to a perl [`Value`](crate::Value).
/// Deserialize a reference to a perl [`Value`].
///
/// Note that this causes all the underlying data to be copied recursively, except for other
/// [`Value`](crate::Value) variables or `&[u8]` or `&str` types, which will reference the
/// "original" value (whatever that means for perl).
/// [`Value`] variables or `&[u8]` or `&str` types, which will reference the "original" value
/// (whatever that means for perl).
pub fn from_ref_value<'de, T>(input: &'de Value) -> Result<T, Error>
where
T: Deserialize<'de>,

View File

@ -1,4 +1,4 @@
//! Module dealing with perl [`Hash`](crate::Hash)es. ([`HV`](crate::ffi::HV) pointers).
//! Module dealing with perl [`Hash`](struct@crate::Hash)es. ([`HV`] pointers).
use crate::error::CastError;
use crate::ffi::{self, HV, SV};
@ -183,7 +183,7 @@ impl std::fmt::Debug for Hash {
///
/// Perl hashes have an integrated iterator. Perl goes to great lengths to make it impossible to
/// properly iterate over a hash without messing with the hash's internal state, so contrary to the
/// array iterator, this iterator always references an existing [`Hash`](crate::Hash).
/// array iterator, this iterator always references an existing [`Hash`](struct@crate::Hash).
pub struct Iter<'a> {
hash: &'a Hash,
}

View File

@ -104,7 +104,7 @@ pub use perlmod_macro::package;
/// Implementing the `TryFrom` trait accordingly can make using blessed references more
/// convenient, but at the cost of hiding underlying `unsafe` code.
///
/// * `#[cv]`: This can be used on a single parameter of type [`&CV`](perlmod::ffi::CV) to get
/// * `#[cv]`: This can be used on a single parameter of type [`&CV`](ffi::CV) to get
/// access to the `xsub` value used to call the function.
///
/// This can be used, for instance, to associate callables with data, or to create attach boxed

View File

@ -112,8 +112,8 @@ macro_rules! destructor {
/// it.
///
/// Note that this only makes sense if the used [`MagicSpec`] does not include a `free` method.
/// This method *is* includded when using its `DEFAULT` or the [`declare_magic!`] macro, so this
/// macro is only required when using custom magic with a custom `DESTROY` sub.
/// This method *is* includded when using its `DEFAULT` or the [`crate::declare_magic!`] macro, so
/// this macro is only required when using custom magic with a custom `DESTROY` sub.
///
/// Due to compiler restrictions, the function itself needs to be written manually, only the
/// contents can be generated using this macro. This also means that the `this` parameter needs to

View File

@ -3,9 +3,9 @@
//! This is a safer alternative to directly blessing raw pointer values as it is more difficult to
//! get the perl side of this wrong.
//!
//! For instance, one major downside of using [`Value::bless_box`] is that it is possible to simply
//! bless invalid values into the same class, or create clones via perl's `Storable::dclone` or
//! `Clone::clone`, which can easily cause a double-free corruption.
//! For instance, one major downside of using [`Value::bless_box`](crate::Value::bless_box) is that
//! it is possible to simply bless invalid values into the same class, or create clones via perl's
//! `Storable::dclone` or `Clone::clone`, which can easily cause a double-free corruption.
//!
//! To avoid this, we can attach a magic value to a perl value (or even multiple magic values if so
//! desired).

View File

@ -601,7 +601,7 @@ impl ScalarRef {
/// Note that the `Cow` part is not required here.
///
/// If `self` is a UTF-8 scalar and its memory representation covers the borrowed substring,
/// this is equivalent to calling [`Scalar::substr`] with the `index` matching the string.
/// this is equivalent to calling [`ScalarRef::substr`] with the `index` matching the string.
///
/// Otherwise (if the provided string is unrelated to `self`), this is also equivalent to
/// calling `[Scalar::new_string]`.

View File

@ -17,7 +17,7 @@ pub fn is_active() -> bool {
raw_value::is_enabled()
}
/// Serialize data into a perl [`Value`](crate::Value).
/// Serialize data into a perl [`Value`].
///
/// Note that in theory it should be safe to send such values to different threads as long as their
/// reference count is exactly one.