Skip to content

Commit 758fe10

Browse files
committed
pager: impl Debug for QueryPager and TypedRowStream
1 parent f6d37a6 commit 758fe10

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

scylla/src/client/pager.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ where
555555
/// needs to be cast into a typed stream. This is done by use of `rows_stream()` method.
556556
/// As the method is generic over the target type, the turbofish syntax
557557
/// can come in handy there, e.g. `query_pager.rows_stream::<(i32, String, Uuid)>()`.
558+
#[derive(Debug)]
558559
pub struct QueryPager {
559560
current_page: RawRowLendingIterator,
560561
page_receiver: mpsc::Receiver<Result<ReceivedPage, NextPageError>>,
@@ -640,7 +641,7 @@ impl QueryPager {
640641
/// Type-checks the iterator against given type.
641642
///
642643
/// This is automatically called upon transforming [QueryPager] into [TypedRowStream].
643-
/// Can be used with `next()` for manual deserialization. See `next()` for an example.
644+
// Can be used with `next()` for manual deserialization.
644645
#[inline]
645646
pub fn type_check<'frame, 'metadata, RowT: DeserializeRow<'frame, 'metadata>>(
646647
&self,
@@ -972,6 +973,17 @@ pub struct TypedRowStream<RowT: 'static> {
972973
_phantom: std::marker::PhantomData<RowT>,
973974
}
974975

976+
// Manual implementation not to depend on RowT implementing Debug.
977+
// Explanation: automatic derive of Debug would impose the RowT: Debug
978+
// constaint for the Debug impl.
979+
impl<T> std::fmt::Debug for TypedRowStream<T> {
980+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
981+
f.debug_struct("TypedRowStream")
982+
.field("raw_row_lending_stream", &self.raw_row_lending_stream)
983+
.finish()
984+
}
985+
}
986+
975987
impl<RowT> Unpin for TypedRowStream<RowT> {}
976988

977989
impl<RowT> TypedRowStream<RowT>

0 commit comments

Comments
 (0)