pub struct ModelListRequest { /* private fields */ }Expand description
Validated model-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::models::ModelListRequest;
let request = ModelListRequest::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 ModelListRequest
impl ModelListRequest
Sourcepub fn with_limit(self, limit: NonZeroUsize) -> Self
pub fn with_limit(self, limit: NonZeroUsize) -> Self
Sets a non-zero result limit.
See crate::models::ModelListRequest 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 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::models::ModelListRequest 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::models::ModelListRequest for a complete example.
Sourcepub fn cursor(&self) -> Option<&str>
pub fn cursor(&self) -> Option<&str>
Returns the provider-native continuation cursor.
See crate::models::ModelListRequest 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::models::ModelListRequest;
let request = ModelListRequest::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 ModelListRequest
impl Clone for ModelListRequest
Source§impl Debug for ModelListRequest
impl Debug for ModelListRequest
Source§impl Default for ModelListRequest
impl Default for ModelListRequest
Source§impl<'de> Deserialize<'de> for ModelListRequest
impl<'de> Deserialize<'de> for ModelListRequest
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 ModelListRequest
Source§impl PartialEq for ModelListRequest
impl PartialEq for ModelListRequest
Source§impl Serialize for ModelListRequest
impl Serialize for ModelListRequest
impl StructuralPartialEq for ModelListRequest
Auto Trait Implementations§
impl Freeze for ModelListRequest
impl RefUnwindSafe for ModelListRequest
impl Send for ModelListRequest
impl Sync for ModelListRequest
impl Unpin for ModelListRequest
impl UnsafeUnpin for ModelListRequest
impl UnwindSafe for ModelListRequest
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.