Skip to content

Commit

Permalink
fix and refine docs
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Jun 10, 2024
1 parent d21f36b commit e80f0eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/common/src/types/cow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ use super::{Datum, DatumRef, ToDatumRef, ToOwnedDatum};
///
/// 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.
///
/// # Usage
///
/// Generally, you don't need to match on the variants of `DatumCow` to access
/// the underlying datum. Instead, you can...
///
/// - call [`to_datum_ref`](ToDatumRef::to_datum_ref) to get a borrowed
/// [`DatumRef`] without any allocation, which can be used to append to an
/// array builder or to encode into the storage representation,
///
/// - call [`to_owned_datum`](ToOwnedDatum::to_owned_datum) to get an owned
/// [`Datum`] with potentially an allocation, which can be used to store in a
/// struct without lifetime constraints.
#[derive(Debug, Clone)]
pub enum DatumCow<'a> {
Borrowed(DatumRef<'a>),
Expand Down
4 changes: 0 additions & 4 deletions src/connector/codec/src/decoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ pub trait Access {
/// and we use different `path` to access one column at a time.
///
/// e.g., for Avro, we access `["col_name"]`; for Debezium Avro, we access `["before", "col_name"]`.
/// 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.
///
/// # Returns
///
Expand Down

0 comments on commit e80f0eb

Please sign in to comment.