pub struct BlockingClient(/* private fields */);
Available on crate feature
client
only.Expand description
A client for interacting with STAC APIs without async.
Implementations§
Source§impl BlockingClient
impl BlockingClient
Sourcepub fn new(url: &str) -> Result<BlockingClient>
pub fn new(url: &str) -> Result<BlockingClient>
Creates a new blocking client.
§Examples
use stac_api::BlockingClient;
let client = BlockingClient::new("https://planetarycomputer.microsoft.com/api/stac/vi").unwrap();
Sourcepub fn search(&self, search: Search) -> Result<BlockingIterator>
pub fn search(&self, search: Search) -> Result<BlockingIterator>
Searches an API, returning an iterable of items.
To prevent fetching all the items (which might be a lot), it is recommended to pass a max_items
.
§Examples
use stac_api::{Search, BlockingClient};
let client = BlockingClient::new("https://planetarycomputer.microsoft.com/api/stac/v1").unwrap();
let mut search = Search { collections: vec!["sentinel-2-l2a".to_string()], ..Default::default() };
let items: Vec<_> = client
.search(search)
.unwrap()
.map(|result| result.unwrap())
.take(1)
.collect();
assert_eq!(items.len(), 1);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BlockingClient
impl !RefUnwindSafe for BlockingClient
impl Send for BlockingClient
impl Sync for BlockingClient
impl Unpin for BlockingClient
impl !UnwindSafe for BlockingClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more