From 29e4b3210b45b9dfc3ccc5146cfac01edbb0c041 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Thu, 13 Mar 2025 07:03:07 +0100 Subject: [PATCH] docs(nix-compat): fix some docstring references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic1b3148f549d8d41a00b5a17f360cc7074fe30ae Reviewed-on: https://cl.tvl.fyi/c/depot/+/13248 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: Domen Kožar Reviewed-by: Marijan Petričević --- tvix/nix-compat/src/derivation/mod.rs | 12 ++++++------ tvix/nix-compat/src/nix_daemon/handler.rs | 5 +++-- tvix/nix-compat/src/store_path/mod.rs | 2 +- tvix/nix-compat/src/wire/protocol_version.rs | 7 ++++--- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/tvix/nix-compat/src/derivation/mod.rs b/tvix/nix-compat/src/derivation/mod.rs index 952fda229..43c9db2b5 100644 --- a/tvix/nix-compat/src/derivation/mod.rs +++ b/tvix/nix-compat/src/derivation/mod.rs @@ -192,8 +192,8 @@ impl Derivation { /// the A-Term. /// /// It's up to the caller of this function to provide a (infallible) lookup - /// function to query [hash_derivation_modulo] of direct input derivations, - /// by their [StorePathRef]. + /// function to query the [Derivation::hash_derivation_modulo] of direct + /// input derivations, by their [StorePathRef]. /// It will only be called in case the derivation is not a fixed-output /// derivation. pub fn hash_derivation_modulo(&self, fn_lookup_hash_derivation_modulo: F) -> [u8; 32] @@ -230,13 +230,13 @@ impl Derivation { /// and self.environment[$outputName] needs to be an empty string. /// /// Output path calculation requires knowledge of the - /// [hash_derivation_modulo], which (in case of non-fixed-output - /// derivations) also requires knowledge of the [hash_derivation_modulo] of - /// input derivations (recursively). + /// [Derivation::hash_derivation_modulo], which (in case of non-fixed-output + /// derivations) also requires knowledge of the + /// [Derivation::hash_derivation_modulo] of input derivations (recursively). /// /// To avoid recursing and doing unnecessary calculation, we simply /// ask the caller of this function to provide the result of the - /// [hash_derivation_modulo] call of the current [Derivation], + /// [Derivation::hash_derivation_modulo] call of the current [Derivation], /// and leave it up to them to calculate it when needed. /// /// On completion, `self.environment[$outputName]` and diff --git a/tvix/nix-compat/src/nix_daemon/handler.rs b/tvix/nix-compat/src/nix_daemon/handler.rs index 6fb45bdb7..8757dced2 100644 --- a/tvix/nix-compat/src/nix_daemon/handler.rs +++ b/tvix/nix-compat/src/nix_daemon/handler.rs @@ -30,8 +30,9 @@ use crate::{nix_daemon::types::NixError, worker_protocol::STDERR_ERROR}; /// As part of its [`initialization`] it performs the handshake with the client /// and determines the [ProtocolVersion] and [ClientSettings] to use for the remainder of the session. /// -/// Once initialized, [`handle_client`] needs to be called to handle the rest of the session, -/// it delegates all operation handling to an instance of [NixDaemonIO]. +/// Once initialized, [NixDaemon::handle_client] needs to be called to handle +/// the rest of the session, it delegates all operation handling to an instance +/// of [NixDaemonIO]. /// /// [`initialization`]: NixDaemon::initialize #[allow(dead_code)] diff --git a/tvix/nix-compat/src/store_path/mod.rs b/tvix/nix-compat/src/store_path/mod.rs index 24991d319..3c4d234eb 100644 --- a/tvix/nix-compat/src/store_path/mod.rs +++ b/tvix/nix-compat/src/store_path/mod.rs @@ -172,7 +172,7 @@ where } } - /// Decompose a string into a [StorePath] and a [PathBuf] containing the + /// Decompose a string into a [StorePath] and a [Path] containing the /// rest of the path, or an error. #[cfg(target_family = "unix")] pub fn from_absolute_path_full<'a, P>(path: &'a P) -> Result<(Self, &'a Path), Error> diff --git a/tvix/nix-compat/src/wire/protocol_version.rs b/tvix/nix-compat/src/wire/protocol_version.rs index 19da28d48..111b82f90 100644 --- a/tvix/nix-compat/src/wire/protocol_version.rs +++ b/tvix/nix-compat/src/wire/protocol_version.rs @@ -3,9 +3,10 @@ static DEFAULT_PROTOCOL_VERSION: ProtocolVersion = ProtocolVersion::from_parts(1 /// Protocol versions are represented as a u16. /// The upper 8 bits are the major version, the lower bits the minor. -/// This is not aware of any endianness, use [crate::wire::read_u64] to get an -/// u64 first, and the try_from() impl from here if you're receiving over the -/// Nix Worker protocol. +/// This is not aware of any endianness. +/// If you're receiving over the Nix worker protocol, you need to read a +/// little-endian encoded u64, and then use the try_from() impl to convert to this +/// type. #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub struct ProtocolVersion(u16);