pub struct ListBlobsRequest {
pub include_dirs: bool,
pub extensions: HashSet<String>,
pub excluded: HashSet<String>,
pub prefix: Option<String>,
}
Expand description
Represents the request options for querying blobs from a storage service.
Fieldsยง
ยงinclude_dirs: bool
Whether if the response should include directory blobs or not. If this set to false, then it will only include file blobs in the given directory where the request is being processed.
extensions: HashSet<String>
A list of extensions to filter for. By default, this will include all file extensions if no entries exist.
excluded: HashSet<String>
List of file names to exclude from the returned entry. This can
exclude directories with the dir:
prefix.
prefix: Option<String>
Optional prefix to set when querying for blobs.
Implementationsยง
Sourceยงimpl ListBlobsRequest
impl ListBlobsRequest
Sourcepub fn exclude<'a, I: Iterator<Item = &'a str>>(self, items: I) -> Self
pub fn exclude<'a, I: Iterator<Item = &'a str>>(self, items: I) -> Self
Appends a slice of strings to exclude from.
Sourcepub fn with_prefix<I: Into<String>>(self, prefix: Option<I>) -> Self
pub fn with_prefix<I: Into<String>>(self, prefix: Option<I>) -> Self
Sets a prefix to this request.
Sourcepub fn with_extensions<'a, I: Iterator<Item = &'a str>>(self, exts: I) -> Self
pub fn with_extensions<'a, I: Iterator<Item = &'a str>>(self, exts: I) -> Self
Appends a list of extensions that can be use to filter files from in the given directory that items were found.
Sourcepub fn with_include_dirs(&mut self, yes: bool) -> &mut Self
pub fn with_include_dirs(&mut self, yes: bool) -> &mut Self
Whether if the response should include directory blobs or not. If this set to false, then it will only include file blobs in the given directory where the request is being processed.
Sourcepub fn is_excluded<I: AsRef<str>>(&self, item: I) -> bool
pub fn is_excluded<I: AsRef<str>>(&self, item: I) -> bool
Sourcepub fn is_ext_allowed<I: AsRef<str>>(&self, ext: I) -> bool
pub fn is_ext_allowed<I: AsRef<str>>(&self, ext: I) -> bool
Checks if an extension is allowed. If the configured extensions
to return is empty, then this will always return true
. Otherwise,
it will try to check if it exists or not.
ยงExample
let mut req = ListBlobsRequest::default();
let _ = req.clone().extensions(&[".txt"]);
assert!(!req.is_ext_allowed(".json"));
assert!(req.is_ext_allowed(".txt"));
let req = ListBlobsRequest::default();
assert!(req.is_ext_allowed(".json"));
Trait Implementationsยง
Sourceยงimpl Clone for ListBlobsRequest
impl Clone for ListBlobsRequest
Sourceยงfn clone(&self) -> ListBlobsRequest
fn clone(&self) -> ListBlobsRequest
1.0.0 ยท Sourceยงconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more