pub struct Db<Sel, T, VP>{ /* private fields */ }Implementationsยง
Sourceยงimpl<Sel, T, VP> Db<Sel, T, VP>
impl<Sel, T, VP> Db<Sel, T, VP>
pub async fn from_env(replication: bool) -> Result<Self, Error>
pub async fn from_database_url( database_url: &str, replication: bool, ) -> Result<Self, Error>
pub async fn from_pool(pool: &PgPool, replication: bool) -> Result<Self, Error>
pub async fn stop_replication(&self) -> Result<(), Error>
pub async fn sync_changes(&mut self) -> Result<HashSet<Index>, Error>
pub fn get_value(&self, name: &'static str, selector: Sel, t: Time) -> f64
pub fn get_value_opt( &self, name: &'static str, selector: Sel, t: Time, ) -> Option<f64>
pub fn register_fn( &self, name: &'static str, selector: Sel, t: Time, value_fn: impl Fn(&Db<Sel, T, VP>) -> f64, ) -> f64
pub fn graph( &self, ) -> &Rc<RefCell<MatrixGraph<(&'static str, Sel, Time), (), Directed, Option<()>, usize>>>
Sourcepub fn subscribe(
&mut self,
name: &'static str,
selector: &Sel,
t: &Time,
) -> Index
pub fn subscribe( &mut self, name: &'static str, selector: &Sel, t: &Time, ) -> Index
TODO: The subscription should be a separate object that automatically unsubscribes when it is dropped.
pub fn unsubscribe(&mut self, _ref: Index)
Sourcepub fn update(
&mut self,
name: &'static str,
selector: &Sel,
t: &Time,
new_value: f64,
) -> HashSet<Index>
pub fn update( &mut self, name: &'static str, selector: &Sel, t: &Time, new_value: f64, ) -> HashSet<Index>
TODO: When updating values in bulk (e.g., in a transaction), we can wait with the recursive part until the end of the transaction. This way, we can avoid updating the same values multiple times.
Auto Trait Implementationsยง
impl<Sel, T, VP> Freeze for Db<Sel, T, VP>where
VP: Freeze,
impl<Sel, T, VP> !RefUnwindSafe for Db<Sel, T, VP>
impl<Sel, T, VP> !Send for Db<Sel, T, VP>
impl<Sel, T, VP> !Sync for Db<Sel, T, VP>
impl<Sel, T, VP> Unpin for Db<Sel, T, VP>
impl<Sel, T, VP> !UnwindSafe for Db<Sel, T, VP>
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