From 3ddf67eb0412e240b88b69192ba901c2a990fb6e Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 30 Jul 2024 15:51:31 +0200 Subject: [PATCH] doc fixups Signed-off-by: Wolfgang Bumiller --- perlmod/src/array.rs | 4 ++-- perlmod/src/de.rs | 12 ++++++------ perlmod/src/hash.rs | 4 ++-- perlmod/src/lib.rs | 2 +- perlmod/src/macros.rs | 4 ++-- perlmod/src/magic.rs | 6 +++--- perlmod/src/scalar.rs | 2 +- perlmod/src/ser.rs | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/perlmod/src/array.rs b/perlmod/src/array.rs index d0e510f..2c49a27 100644 --- a/perlmod/src/array.rs +++ b/perlmod/src/array.rs @@ -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, diff --git a/perlmod/src/de.rs b/perlmod/src/de.rs index 99017f3..35bb0c4 100644 --- a/perlmod/src/de.rs +++ b/perlmod/src/de.rs @@ -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(input: Value) -> Result 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 where T: Deserialize<'de>, diff --git a/perlmod/src/hash.rs b/perlmod/src/hash.rs index 96a56d4..b2148e7 100644 --- a/perlmod/src/hash.rs +++ b/perlmod/src/hash.rs @@ -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, } diff --git a/perlmod/src/lib.rs b/perlmod/src/lib.rs index e4eac8f..c360835 100644 --- a/perlmod/src/lib.rs +++ b/perlmod/src/lib.rs @@ -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 diff --git a/perlmod/src/macros.rs b/perlmod/src/macros.rs index 38c137a..29bc9bc 100644 --- a/perlmod/src/macros.rs +++ b/perlmod/src/macros.rs @@ -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 diff --git a/perlmod/src/magic.rs b/perlmod/src/magic.rs index 47f7691..9f05c91 100644 --- a/perlmod/src/magic.rs +++ b/perlmod/src/magic.rs @@ -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). diff --git a/perlmod/src/scalar.rs b/perlmod/src/scalar.rs index 9d53a85..c849e6b 100644 --- a/perlmod/src/scalar.rs +++ b/perlmod/src/scalar.rs @@ -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]`. diff --git a/perlmod/src/ser.rs b/perlmod/src/ser.rs index 9561615..06f5d44 100644 --- a/perlmod/src/ser.rs +++ b/perlmod/src/ser.rs @@ -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.