pub struct Session<'scope, 'd: 'scope, S = (), Q = ()> { /* private fields */ }Implementations§
Source§impl<'scope, 'd: 'scope, S, Q> Session<'scope, 'd, S, Q>
impl<'scope, 'd: 'scope, S, Q> Session<'scope, 'd, S, Q>
Sourcepub fn storage(&self) -> &'d Swhere
S: 'd,
pub fn storage(&self) -> &'d Swhere
S: 'd,
Storage for the complete driver domain. Its domain lifetime is independent of the temporary session borrow.
Sourcepub fn driver_access(&mut self) -> Context<'_, 'd>
pub fn driver_access(&mut self) -> Context<'_, 'd>
Returns the session’s exclusive driver context for staging resources.
The access lifetime is tied to this mutable session borrow. Consequently the context cannot escape the generative executor scope, overlap another driver context, or coexist with an installed application.
ⓘ
use dope_core::driver;
use dope_runtime::executor::Executor;
fn escape(executor: Executor) -> driver::Context<'static, 'static> {
executor.enter(|mut session| session.driver_access())
}ⓘ
use dope_runtime::executor::{self, Application};
fn overlap<'scope, 'd, D>(
session: &mut executor::session::Session<'scope, 'd>,
app: D,
) where
'd: 'scope,
D: Application<'d>,
{
let driver = session.driver_access();
let _ = session.with_app(app, |_| {});
drop(driver);
}ⓘ
use dope_runtime::executor::session::Session;
fn duplicate<'scope, 'd>(session: &mut Session<'scope, 'd>)
where
'd: 'scope,
{
let first = session.driver_access();
let second = session.driver_access();
drop((first, second));
}Sourcepub fn hash_state(&mut self, domain: Domain) -> HashState<'d>
pub fn hash_state(&mut self, domain: Domain) -> HashState<'d>
Issues a keyed hash builder bound to this exact driver domain.
ⓘ
use dope_runtime::{
executor::Executor,
random::{Domain, HashState},
};
fn escape(executor: Executor) -> HashState<'static> {
executor.enter(|mut session| session.hash_state(Domain::new(0)))
}Sourcepub fn with_app<D, R>(
&mut self,
app: D,
f: impl for<'app> FnOnce(Application<'app, 'd, D, Q>) -> R,
) -> Result<R>where
D: Application<'d>,
Q: Startup,
pub fn with_app<D, R>(
&mut self,
app: D,
f: impl for<'app> FnOnce(Application<'app, 'd, D, Q>) -> R,
) -> Result<R>where
D: Application<'d>,
Q: Startup,
Installs one application for f and finalizes it on normal return.
§Panics
Application or callback panics are terminal; session reuse is not guaranteed.
Sourcepub fn with_provider<O, P, C>(
&mut self,
owner: O,
select: impl for<'borrow> FnOnce(Pin<&'borrow O>) -> Pin<&'borrow P>,
composition: C,
) -> C::Outputwhere
P: Provider<'d>,
C: Composition<'scope, 'd, S, Q, O, P>,
pub fn with_provider<O, P, C>(
&mut self,
owner: O,
select: impl for<'borrow> FnOnce(Pin<&'borrow O>) -> Pin<&'borrow P>,
composition: C,
) -> C::Outputwhere
P: Provider<'d>,
C: Composition<'scope, 'd, S, Q, O, P>,
Runs a composition with a pinned provider owner and its scoped client. The higher-ranked application lifetime prevents either from escaping.
Auto Trait Implementations§
impl<'scope, 'd, S = (), Q = ()> !RefUnwindSafe for Session<'scope, 'd, S, Q>
impl<'scope, 'd, S = (), Q = ()> !Send for Session<'scope, 'd, S, Q>
impl<'scope, 'd, S = (), Q = ()> !Sync for Session<'scope, 'd, S, Q>
impl<'scope, 'd, S = (), Q = ()> !UnwindSafe for Session<'scope, 'd, S, Q>
impl<'scope, 'd, S, Q> Freeze for Session<'scope, 'd, S, Q>
impl<'scope, 'd, S, Q> Unpin for Session<'scope, 'd, S, Q>
impl<'scope, 'd, S, Q> UnsafeUnpin for Session<'scope, 'd, S, Q>
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