pub struct Session {
pub inner: Arc<Inner>,
}
Expand description
Synchronous AvesTerra client.
Exposes the same API as SessionAsync
, but all methods are blocking.
This Session is backed by a Tokio runtime and internally uses a SessionAsync.
This makes it possible to switch to using the asynchronous client at any
time.
See the example [examples/hybrid_sync_async.rs
] for an example of how to
do that.
WARNING: CALLING .call()
WILL PANIC IF USED FROM AN ASYNCHRONOUS CONTEXT.
IF YOU WANT TO USE YOUR OWN ASYNCHRONOUS CONTEXT, USE SessionAsync
.
Session
WILL CREATE ITS OWN CONTEXT, AND THERE SHOULD ONLY BE ONE.
(it’s technically possible to have multiple, but you have to be very careful,
and it’s probably not what you want anyways).
See SessionAsync
for more details.
You need to create the Session
with Session::initialize
Fields§
§inner: Arc<Inner>
Implementations§
Source§impl Session
impl Session
pub fn initialize(config: SessionConfig) -> Result<Self>
Sourcepub fn finalize(self)
pub fn finalize(self)
Cleanly closes all connections. This method will wait for all currently used connections to be returned to the pool. This might take a while depending on how long is the queue of calls waiting for a connection. In an ideal world this would have been implemented better and the queue of pending calls would have been cancelled, but it’s not the case, sorry.