Skip to content

Commit

Permalink
Merge pull request #1090 from Lorak-mmk/serialization_exports
Browse files Browse the repository at this point in the history
scylla/lib.rs: Remove stars in serialization frameworks imports
  • Loading branch information
Lorak-mmk authored Oct 16, 2024
2 parents 01255af + dcd1790 commit f9a3635
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 3 deletions.
3 changes: 3 additions & 0 deletions scylla-cql/src/types/serialize/batch.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//! Contains the [`BatchValues`] and [`BatchValuesIterator`] trait and their
//! implementations.
// Note: When editing above doc-comment edit the corresponding comment on
// re-export module in scylla crate too.

use crate::frame::value::{LegacyBatchValues, LegacyBatchValuesIterator};

use super::row::{RowSerializationContext, SerializeRow};
Expand Down
3 changes: 3 additions & 0 deletions scylla-cql/src/types/serialize/row.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Contains the [`SerializeRow`] trait and its implementations.
// Note: When editing above doc-comment edit the corresponding comment on
// re-export module in scylla crate too.

use std::borrow::Cow;
use std::collections::{BTreeMap, HashSet};
use std::fmt::Display;
Expand Down
3 changes: 3 additions & 0 deletions scylla-cql/src/types/serialize/value.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Contains the [`SerializeValue`] trait and its implementations.
// Note: When editing above doc-comment edit the corresponding comment on
// re-export module in scylla crate too.

use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::fmt::Display;
use std::hash::BuildHasher;
Expand Down
3 changes: 3 additions & 0 deletions scylla-cql/src/types/serialize/writers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//! Contains types and traits used for safe serialization of values for a CQL statement.
// Note: When editing above doc-comment edit the corresponding comment on
// re-export module in scylla crate too.

use thiserror::Error;

use super::row::SerializedValues;
Expand Down
72 changes: 69 additions & 3 deletions scylla/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
//! # Ok(())
//! # }
//! ```
//! But the driver will accept anything implementing the trait [SerializeRow]
//! (crate::serialize::row::SerializeRow)
//! But the driver will accept anything implementing the trait [SerializeRow].
//!
//! ### Receiving results
//! The easiest way to read rows returned by a query is to cast each row to a tuple of values:
Expand Down Expand Up @@ -131,8 +130,75 @@ pub mod frame {
}

/// Serializing bound values of a query to be sent to the DB.
// Note: When editing comment on submodules here edit corresponding comments
// on scylla-cql modules too.
pub mod serialize {
pub use scylla_cql::types::serialize::*;
pub use scylla_cql::types::serialize::SerializationError;
/// Contains the [BatchValues][batch::BatchValues] and [BatchValuesIterator][batch::BatchValuesIterator] trait and their
/// implementations.
pub mod batch {
// Main types
pub use scylla_cql::types::serialize::batch::{
BatchValues, BatchValuesFromIterator, BatchValuesIterator,
BatchValuesIteratorFromIterator, TupleValuesIter,
};

// Legacy migration types - to be removed when removing legacy framework
pub use scylla_cql::types::serialize::batch::{
LegacyBatchValuesAdapter, LegacyBatchValuesIteratorAdapter,
};
}

/// Contains the [SerializeRow][row::SerializeRow] trait and its implementations.
pub mod row {
// Main types
pub use scylla_cql::types::serialize::row::{RowSerializationContext, SerializeRow};

// Errors
pub use scylla_cql::types::serialize::row::{
BuiltinSerializationError, BuiltinSerializationErrorKind, BuiltinTypeCheckError,
BuiltinTypeCheckErrorKind,
};

// Legacy migration types - to be removed when removing legacy framework
pub use scylla_cql::types::serialize::row::{
// Legacy migration types - to be removed when removing legacy framework
serialize_legacy_row,
ValueListAdapter,
ValueListToSerializeRowAdapterError,
};

// Not part of the old framework, but something that we should
// still aim to remove from public API.
pub use scylla_cql::types::serialize::row::{SerializedValues, SerializedValuesIterator};
}

/// Contains the [SerializeValue][value::SerializeValue] trait and its implementations.
pub mod value {
// Main types
pub use scylla_cql::types::serialize::value::SerializeValue;

// Errors
pub use scylla_cql::types::serialize::value::{
BuiltinSerializationError, BuiltinSerializationErrorKind, BuiltinTypeCheckError,
BuiltinTypeCheckErrorKind, MapSerializationErrorKind, MapTypeCheckErrorKind,
SetOrListSerializationErrorKind, SetOrListTypeCheckErrorKind,
TupleSerializationErrorKind, TupleTypeCheckErrorKind, UdtSerializationErrorKind,
UdtTypeCheckErrorKind,
};

// Legacy migration types - to be removed when removing legacy framework
pub use scylla_cql::types::serialize::value::{
serialize_legacy_value, ValueAdapter, ValueToSerializeValueAdapterError,
};
}

/// Contains types and traits used for safe serialization of values for a CQL statement.
pub mod writers {
pub use scylla_cql::types::serialize::writers::{
CellOverflowError, CellValueBuilder, CellWriter, RowWriter, WrittenCellProof,
};
}
}

/// Deserializing DB response containing CQL query results.
Expand Down

0 comments on commit f9a3635

Please sign in to comment.