Skip to content

Commit

Permalink
docs: update Validity docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrobbel committed Jul 26, 2023
1 parent 50c9d81 commit 12f9079
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ use crate::{buffer::BufferType, nullable::Nullable};
/// Validity trait for nullable and non-nullable data.
///
/// This trait has an associated type for storage that is `T` when `NULLABLE` is
/// `false` and `Nullable<T, Buffer>` when `NULLABLE` is `true`. In other
/// words, this trait allows wrapping storage types in a `Nullable`, basically
/// adding a [Bitmap](crate::bitmap::Bitmap) that stores validity information,
/// depending on the const generic `NULLABLE`.
/// `false` and [Nullable<T, Buffer>] when `NULLABLE` is `true`. In other
/// words, this trait allows wrapping storage types in a [Nullable], adding a
/// [Bitmap](crate::bitmap::Bitmap) that stores validity information, depending
/// on the const generic `NULLABLE`.
pub trait Validity<const NULLABLE: bool> {
/// Storage type constructor for data.
///
/// Generic over a [Bitmap](crate::bitmap::Bitmap)'s [BufferType].
type Storage<BitmapBuffer: BufferType>;
/// Generic over a [BufferType].
type Storage<Buffer: BufferType>;
}

impl<T> Validity<false> for T {
type Storage<BitmapBuffer: BufferType> = T;
type Storage<Buffer: BufferType> = T;
}

impl<T> Validity<true> for T {
type Storage<BitmapBuffer: BufferType> = Nullable<T, BitmapBuffer>;
type Storage<Buffer: BufferType> = Nullable<T, Buffer>;
}

0 comments on commit 12f9079

Please sign in to comment.