Struct edgedb_tokio::state::GlobalsModifier
source · pub struct GlobalsModifier<'a> { /* private fields */ }
Expand description
Utility object used to modify globals
This object is passed to Fn
closure and GlobalsDelta::apply
.
Implementations§
source§impl GlobalsModifier<'_>
impl GlobalsModifier<'_>
sourcepub fn set<T: QueryArg>(&mut self, key: &str, value: T)
pub fn set<T: QueryArg>(&mut self, key: &str, value: T)
Set global variable to a value
If key
doesn’t contain module name (::
to be more
specific) then the variable name is resolved using current module.
Otherwise, modules are resolved using aliases if any. Note: modules are
resolved at method call time. This means that a sequence like this:
let conn = conn
.with_globals_fn(|m| m.set("var1", "value1"))
.with_default_module(Some("another_module"))
.with_globals_fn(|m| m.set("var1", "value2"));
Will set var1
in default
and in another_module
to different
values.
§Panics
This methods panics if value
cannot be converted into dynamically
typed Value
(QueryArg::to_value()
method returns error). To avoid
this panic use either native EdgeDB types (e.g.
edgedb_protocol::model::Datetime
instead of std::time::SystemTime
or call to_value
manually before passing to set
.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for GlobalsModifier<'a>
impl<'a> RefUnwindSafe for GlobalsModifier<'a>
impl<'a> Send for GlobalsModifier<'a>
impl<'a> Sync for GlobalsModifier<'a>
impl<'a> Unpin for GlobalsModifier<'a>
impl<'a> !UnwindSafe for GlobalsModifier<'a>
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