pub struct FileListRequest { /* private fields */ }Expand description
Validated file-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::files::FileListRequest;
let request = FileListRequest::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 FileListRequest
impl FileListRequest
Sourcepub fn with_limit(self, limit: NonZeroUsize) -> Self
pub fn with_limit(self, limit: NonZeroUsize) -> Self
Sets a non-zero result limit.
§Examples
use providers_kit::files::FileListRequest;
let request = FileListRequest::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"));
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.
§Examples
use providers_kit::files::FileListRequest;
let request = FileListRequest::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"));
Sourcepub const fn limit(&self) -> Option<NonZeroUsize>
pub const fn limit(&self) -> Option<NonZeroUsize>
Returns the requested result limit.
§Examples
use providers_kit::files::FileListRequest;
let request = FileListRequest::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"));
Sourcepub fn cursor(&self) -> Option<&str>
pub fn cursor(&self) -> Option<&str>
Returns the provider-native continuation cursor.
§Examples
use providers_kit::files::FileListRequest;
let request = FileListRequest::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"));
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::files::FileListRequest;
let request = FileListRequest::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 FileListRequest
impl Clone for FileListRequest
Source§impl Debug for FileListRequest
impl Debug for FileListRequest
Source§impl Default for FileListRequest
impl Default for FileListRequest
Source§impl<'de> Deserialize<'de> for FileListRequest
impl<'de> Deserialize<'de> for FileListRequest
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FileListRequest
Source§impl PartialEq for FileListRequest
impl PartialEq for FileListRequest
Source§impl Serialize for FileListRequest
impl Serialize for FileListRequest
impl StructuralPartialEq for FileListRequest
Auto Trait Implementations§
impl Freeze for FileListRequest
impl RefUnwindSafe for FileListRequest
impl Send for FileListRequest
impl Sync for FileListRequest
impl Unpin for FileListRequest
impl UnsafeUnpin for FileListRequest
impl UnwindSafe for FileListRequest
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.