aws_sdk_connectcases/operation/get_case/
paginator.rs1pub struct GetCasePaginator {
4 handle: std::sync::Arc<crate::client::Handle>,
5 builder: crate::operation::get_case::builders::GetCaseInputBuilder,
6 stop_on_duplicate_token: bool,
7}
8
9impl GetCasePaginator {
10 pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>, builder: crate::operation::get_case::builders::GetCaseInputBuilder) -> Self {
12 Self {
13 handle,
14 builder,
15 stop_on_duplicate_token: true,
16 }
17 }
18
19 pub fn stop_on_duplicate_token(mut self, stop_on_duplicate_token: bool) -> Self {
27 self.stop_on_duplicate_token = stop_on_duplicate_token;
28 self
29 }
30
31 pub fn send(
36 self,
37 ) -> ::aws_smithy_async::future::pagination_stream::PaginationStream<
38 ::std::result::Result<
39 crate::operation::get_case::GetCaseOutput,
40 ::aws_smithy_runtime_api::client::result::SdkError<
41 crate::operation::get_case::GetCaseError,
42 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
43 >,
44 >,
45 > {
46 let builder = self.builder;
48 let handle = self.handle;
49 let runtime_plugins =
50 crate::operation::get_case::GetCase::operation_runtime_plugins(handle.runtime_plugins.clone(), &handle.conf, ::std::option::Option::None)
51 .with_operation_plugin(crate::sdk_feature_tracker::paginator::PaginatorFeatureTrackerRuntimePlugin::new());
52 ::aws_smithy_async::future::pagination_stream::PaginationStream::new(::aws_smithy_async::future::pagination_stream::fn_stream::FnStream::new(
53 move |tx| {
54 ::std::boxed::Box::pin(async move {
55 let mut input = match builder
57 .build()
58 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)
59 {
60 ::std::result::Result::Ok(input) => input,
61 ::std::result::Result::Err(e) => {
62 let _ = tx.send(::std::result::Result::Err(e)).await;
63 return;
64 }
65 };
66 loop {
67 let resp = crate::operation::get_case::GetCase::orchestrate(&runtime_plugins, input.clone()).await;
68 let done = match resp {
70 ::std::result::Result::Ok(ref resp) => {
71 let new_token = crate::lens::reflens_get_case_output_output_next_token(resp);
72 let is_empty = new_token.map(|token| token.is_empty()).unwrap_or(true);
74 if !is_empty && new_token == input.next_token.as_ref() && self.stop_on_duplicate_token {
75 true
76 } else {
77 input.next_token = new_token.cloned();
78 is_empty
79 }
80 }
81 ::std::result::Result::Err(_) => true,
82 };
83 if tx.send(resp).await.is_err() {
84 return;
86 }
87 if done {
88 return;
89 }
90 }
91 })
92 },
93 ))
94 }
95}