From d6b28bedc4df89c7ecfc84b7efc2bac9d20e89fe Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 10 Jun 2024 10:33:34 +0800 Subject: [PATCH] fix typo & refine doc Signed-off-by: Bugen Zhao --- src/common/src/types/cow.rs | 3 +++ src/connector/codec/src/decoder/mod.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/src/types/cow.rs b/src/common/src/types/cow.rs index 65e3bd6a741fe..bc0b6065dd605 100644 --- a/src/common/src/types/cow.rs +++ b/src/common/src/types/cow.rs @@ -15,6 +15,9 @@ use super::{Datum, DatumRef, ToDatumRef, ToOwnedDatum}; /// 🐮 A borrowed [`DatumRef`] or an owned [`Datum`]. +/// +/// We do not use [`std::borrow::Cow`] because it requires the borrowed variant +/// to be a reference, whereas what we have is a [`DatumRef`] with a lifetime. #[derive(Debug, Clone)] pub enum DatumCow<'a> { Borrowed(DatumRef<'a>), diff --git a/src/connector/codec/src/decoder/mod.rs b/src/connector/codec/src/decoder/mod.rs index 54ff3ef56f17a..8e5d15221970f 100644 --- a/src/connector/codec/src/decoder/mod.rs +++ b/src/connector/codec/src/decoder/mod.rs @@ -61,7 +61,7 @@ pub trait Access { .map(ToOwnedDatum::to_owned_datum) } - /// Similar to `access`, but may return a borrowed [`DatumCow::Ref`] to avoid unnecessary allocation. + /// Similar to `access`, but may return a borrowed [`DatumCow::Borrowed`] to avoid unnecessary allocation. /// If not overridden, it will call forward to `access` and always wrap the result in [`DatumCow::Owned`]. /// /// This should be preferred over `access` for both callers and implementors.