#[cfg(feature = "secondary-indexes")]
pub use pipecircuit_macros::RangeIndexKey;
pub use pipecircuit_macros::WarpTableRow;
#[doc(hidden)]
pub mod __private {
pub use super::inconsistency::invariant_violation;
#[cfg(feature = "secondary-indexes")]
pub use super::query::{
bind_detached_range_lookup, bind_detached_secondary_lookup, bind_mutable_range_lookup,
bind_mutable_secondary_lookup, bind_range_lookup, bind_secondary_lookup,
own_secondary_membership,
};
#[cfg(feature = "secondary-indexes")]
pub use super::secondary_index::{
PreparedRangeIndexInsert, PreparedRangeIndexMove, PreparedRangeIndexRemove,
PreparedSecondaryIndexInsert, PreparedSecondaryIndexMove, PreparedSecondaryIndexRemove,
PreparedSlotSetInsert, PreparedStableSlotInsert, PreparedStableSlotRemove, RangeIndex,
RangeIndexCreationError, RangeIndexInconsistency, RangeIndexInsertError,
RangeIndexInsertOutcome, RangeIndexMembership, RangeIndexMoveError, RangeIndexMoveOutcome,
RangeIndexRemoveError, RangeIndexRemoveOutcome, SecondaryIndex,
SecondaryIndexCommitRemoveOutcome, SecondaryIndexCreationError,
SecondaryIndexInconsistency, SecondaryIndexInsertError, SecondaryIndexInsertOutcome,
SecondaryIndexMembership, SecondaryIndexMoveError, SecondaryIndexMoveOutcome,
SecondaryIndexPrepareRemoveOutcome, SecondaryIndexRemoveError, SecondaryIndexRemoveOutcome,
SecondaryIndexRemoveResult, SlotSet, SlotSetInsertError, SlotSetInsertOutcome,
SlotSetRemoveOutcome, SlotSetSlots, StableSlot, StableSlotInsertError,
StableSlotRemoveOutcome, StableSlotResolutions, StableSlotResolveOutcome,
StableSlotResolver, StableSlotRowRelocation, StableSlots, StableSlotsCreationError,
StableSlotsInconsistency,
};
pub use alloc::{collections::TryReserveError, vec::Vec};
}
mod creation;
mod dense_key_index;
mod get;
mod id;
mod inconsistency;
mod insert;
mod query;
mod remove;
mod replace;
mod row;
mod rows;
#[cfg(feature = "secondary-indexes")]
mod secondary_index;
mod update;
mod upsert;
pub use creation::{Capacity, WarpTableCreationError};
use dense_key_index::DenseKeyIndex;
pub use get::{WarpTableGetAtOutcome, WarpTableGetOutcome};
pub use id::{WarpId, integer_index_word, sequential_index_word};
pub use inconsistency::WarpTableInconsistency;
pub use insert::{WarpTableInsertAllOutcome, WarpTableInsertOutcome, WarpTableInsertWithIdOutcome};
#[cfg(feature = "secondary-indexes")]
#[doc(hidden)]
pub use query::SelectionOperand;
#[cfg(feature = "secondary-indexes")]
#[doc(hidden)]
pub use query::{
DetachedRangeIndexLookupOutcome, DetachedSecondaryIndexLookupOutcome, DetachedSelection,
MutableSelectionOperand,
};
#[cfg(feature = "secondary-indexes")]
pub use query::{
MutableRangeIndexLookupOutcome, MutableSecondaryIndexLookupOutcome, MutableSelection,
MutableSelectionForEachOutcome, RangeIndexLookupOutcome, SecondaryIndexLookupOutcome,
Selection, SelectionMembershipInconsistency, SelectionRows,
};
pub use remove::{WarpTableRemoveOutcome, WarpTableRowRelocation};
pub use replace::WarpTableReplaceOutcome;
pub use row::{
IndexKey, WarpTableRow, WarpTableRowGetError, WarpTableRowGetOutcome, WarpTableRowReplaceError,
WarpTableRowReplaceOutcome,
};
pub use rows::WarpTableRows;
#[cfg(feature = "secondary-indexes")]
pub use secondary_index::SecondaryIndexInconsistency;
#[cfg(feature = "secondary-indexes")]
pub use secondary_index::{
RangeIndexBounds, RangeIndexCreationError, RangeIndexInconsistency, RangeIndexInsertFailure,
RangeIndexKey, RangeIndexLookupError, RangeIndexMoveFailure, RangeIndexRemoveFailure,
SecondaryIndexInsertFailure, SecondaryIndexMoveFailure, SecondaryIndexRemoveFailure,
StableMembershipInsertFailure,
};
pub use update::WarpTableUpdateOutcome;
pub use upsert::WarpTableUpsertOutcome;
pub struct WarpTable<Row: WarpTableRow, Brand = Row> {
capacity: Capacity,
maximum_rows: usize,
len: usize,
next_id: Option<core::num::NonZeroU64>,
primary_keys: __private::Vec<Row::Key>,
columns: Row::Columns,
indexes: Row::Indexes,
primary_index: DenseKeyIndex,
brand: core::marker::PhantomData<fn() -> Brand>,
}
impl<Row: WarpTableRow, Brand> WarpTable<Row, Brand> {
pub const fn capacity(&self) -> Capacity {
self.capacity
}
pub const fn len(&self) -> usize {
self.len
}
pub const fn is_empty(&self) -> bool {
self.len == 0
}
pub fn primary_keys(&self) -> &[Row::Key] {
&self.primary_keys
}
pub const fn columns(&self) -> &Row::Columns {
&self.columns
}
#[doc(hidden)]
pub const fn __indexes(&self) -> &Row::Indexes {
&self.indexes
}
}
#[cfg(test)]
mod derive_tests;
#[cfg(test)]
mod tests;