pub struct BatchListRequest { /* private fields */ }Expand description
Validated batch-list pagination request.
Pagination cursors are opaque provider-owned values; a requested limit is not a guarantee that every provider supports the same pagination controls.
§Examples
use providers_kit::batch::BatchListRequest;
let request = BatchListRequest::default()
.with_limit(std::num::NonZeroUsize::new(10).unwrap())
.with_cursor("opaque-next")?;
assert_eq!(request.limit().unwrap().get(), 10);
assert_eq!(request.cursor(), Some("opaque-next"));
Implementations§
Source§impl BatchListRequest
impl BatchListRequest
Sourcepub fn with_limit(self, limit: NonZeroUsize) -> Self
pub fn with_limit(self, limit: NonZeroUsize) -> Self
Sets a non-zero result limit.
See crate::batch::BatchListRequest for a complete example.
Sourcepub fn with_cursor(self, cursor: impl Into<String>) -> Result<Self, KitError>
pub fn with_cursor(self, cursor: impl Into<String>) -> Result<Self, KitError>
Sets a non-empty provider-native continuation cursor.
§Errors
Returns an input error when the cursor is empty or whitespace-only. Nonblank cursor bytes are retained exactly; use only a cursor returned by the same provider operation.
See crate::batch::BatchListRequest for a complete example.
Sourcepub const fn limit(&self) -> Option<NonZeroUsize>
pub const fn limit(&self) -> Option<NonZeroUsize>
Returns the requested result limit.
See crate::batch::BatchListRequest for a complete example.
Sourcepub fn cursor(&self) -> Option<&str>
pub fn cursor(&self) -> Option<&str>
Returns the provider-native continuation cursor.
See crate::batch::BatchListRequest for a complete example.
Sourcepub fn into_parts(self) -> (Option<NonZeroUsize>, Option<String>)
pub fn into_parts(self) -> (Option<NonZeroUsize>, Option<String>)
Consumes the request into its limit and continuation cursor.
§Examples
use providers_kit::batch::BatchListRequest;
let request = BatchListRequest::default()
.with_limit(std::num::NonZeroUsize::new(10).unwrap())
.with_cursor("opaque-next")?;
let (limit, cursor) = request.into_parts();
assert_eq!(limit.unwrap().get(), 10);
assert_eq!(cursor.as_deref(), Some("opaque-next"));
Trait Implementations§
Source§impl Clone for BatchListRequest
impl Clone for BatchListRequest
Source§impl Debug for BatchListRequest
impl Debug for BatchListRequest
Source§impl Default for BatchListRequest
impl Default for BatchListRequest
Source§impl<'de> Deserialize<'de> for BatchListRequest
impl<'de> Deserialize<'de> for BatchListRequest
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for BatchListRequest
Source§impl PartialEq for BatchListRequest
impl PartialEq for BatchListRequest
Source§impl Serialize for BatchListRequest
impl Serialize for BatchListRequest
impl StructuralPartialEq for BatchListRequest
Auto Trait Implementations§
impl Freeze for BatchListRequest
impl RefUnwindSafe for BatchListRequest
impl Send for BatchListRequest
impl Sync for BatchListRequest
impl Unpin for BatchListRequest
impl UnsafeUnpin for BatchListRequest
impl UnwindSafe for BatchListRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.