pub enum State<Txn> {
Closure(Closure<Txn>),
Map(Map<Self>),
Object(Object<Txn>),
Scalar(Scalar),
Tuple(Tuple<Self>),
}
Expand description
An addressable state with a discrete value per-transaction.
Variants§
Implementations§
Source§impl<Txn> State<Txn>
impl<Txn> State<Txn>
Trait Implementations§
Source§impl<Txn, T1, T2, T3> CastFrom<(T1, T2, T3)> for State<Txn>
impl<Txn, T1, T2, T3> CastFrom<(T1, T2, T3)> for State<Txn>
Source§fn cast_from(value: (T1, T2, T3)) -> Self
fn cast_from(value: (T1, T2, T3)) -> Self
Cast an instance of
T
into an instance of Self
.Source§impl<Txn, T1, T2, T3, T4> CastFrom<(T1, T2, T3, T4)> for State<Txn>
impl<Txn, T1, T2, T3, T4> CastFrom<(T1, T2, T3, T4)> for State<Txn>
Source§fn cast_from(value: (T1, T2, T3, T4)) -> Self
fn cast_from(value: (T1, T2, T3, T4)) -> Self
Cast an instance of
T
into an instance of Self
.Source§impl<Txn> ClosureInstance<State<Txn>> for Closure<Txn>
impl<Txn> ClosureInstance<State<Txn>> for Closure<Txn>
Source§impl<Txn> From<InstanceClass> for State<Txn>
impl<Txn> From<InstanceClass> for State<Txn>
Source§fn from(class: InstanceClass) -> Self
fn from(class: InstanceClass) -> Self
Converts to this type from the input type.
Source§impl<Txn> From<Map<InstanceClass>> for State<Txn>
impl<Txn> From<Map<InstanceClass>> for State<Txn>
Source§fn from(map: Map<InstanceClass>) -> Self
fn from(map: Map<InstanceClass>) -> Self
Converts to this type from the input type.
Source§impl<Txn> FromStream for State<Txn>
impl<Txn> FromStream for State<Txn>
Source§impl<'a, Txn> Handler<'a, State<Txn>> for Closure<Txn>
impl<'a, Txn> Handler<'a, State<Txn>> for Closure<Txn>
fn get<'b>(self: Box<Self>) -> Option<GetHandler<'a, 'b, Txn, State<Txn>>>where
'b: 'a,
fn put<'b>(self: Box<Self>) -> Option<PutHandler<'a, 'b, Txn, State<Txn>>>where
'b: 'a,
fn post<'b>(self: Box<Self>) -> Option<PostHandler<'a, 'b, Txn, State<Txn>>>where
'b: 'a,
fn delete<'b>(self: Box<Self>) -> Option<DeleteHandler<'a, 'b, Txn>>where
'b: 'a,
Source§impl<'en, Txn> IntoView<'en, CacheBlock> for State<Txn>
impl<'en, Txn> IntoView<'en, CacheBlock> for State<Txn>
Source§type Txn = Txn
type Txn = Txn
The type of
Transaction
which this state supportsSource§impl<Txn> Refer<State<Txn>> for State<Txn>
impl<Txn> Refer<State<Txn>> for State<Txn>
Source§fn dereference_self(self, path: &TCPathBuf) -> Self
fn dereference_self(self, path: &TCPathBuf) -> Self
Replace references to “$self” with the given relative path. Read more
Source§fn is_conditional(&self) -> bool
fn is_conditional(&self) -> bool
Return
true
if this is a conditional reference (e.g. If
or Case
).Source§fn is_inter_service_write(&self, cluster_path: &[PathSegment]) -> bool
fn is_inter_service_write(&self, cluster_path: &[PathSegment]) -> bool
Return
true
if this references a write operation to a cluster other than the path given.Source§fn reference_self(self, path: &TCPathBuf) -> Self
fn reference_self(self, path: &TCPathBuf) -> Self
Replace the given relative path with “$self”. Read more
Source§fn requires(&self, deps: &mut HashSet<Id>)
fn requires(&self, deps: &mut HashSet<Id>)
Add the dependency
Id
s of this reference to the given set.Source§impl<Txn> Route<State<Txn>> for InstanceClass
impl<Txn> Route<State<Txn>> for InstanceClass
Source§impl<Txn, T> Route<State<Txn>> for InstanceExt<Txn, T>
impl<Txn, T> Route<State<Txn>> for InstanceExt<Txn, T>
Source§impl<Txn> Route<State<Txn>> for ObjectType
impl<Txn> Route<State<Txn>> for ObjectType
Source§impl<Txn> StateInstance for State<Txn>
impl<Txn> StateInstance for State<Txn>
Source§impl<Txn, T> ToState<State<Txn>> for InstanceExt<Txn, T>
impl<Txn, T> ToState<State<Txn>> for InstanceExt<Txn, T>
Source§impl<Txn, T> TryCastFrom<State<Txn>> for (T,)where
T: TryCastFrom<State<Txn>>,
impl<Txn, T> TryCastFrom<State<Txn>> for (T,)where
T: TryCastFrom<State<Txn>>,
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn, T1, T2> TryCastFrom<State<Txn>> for (T1, T2)
impl<Txn, T1, T2> TryCastFrom<State<Txn>> for (T1, T2)
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn, T1, T2, T3> TryCastFrom<State<Txn>> for (T1, T2, T3)
impl<Txn, T1, T2, T3> TryCastFrom<State<Txn>> for (T1, T2, T3)
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Box<dyn ClosureInstance<State<Txn>>>
impl<Txn> TryCastFrom<State<Txn>> for Box<dyn ClosureInstance<State<Txn>>>
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Bytes
impl<Txn> TryCastFrom<State<Txn>> for Bytes
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Closure<Txn>
impl<Txn> TryCastFrom<State<Txn>> for Closure<Txn>
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Float
impl<Txn> TryCastFrom<State<Txn>> for Float
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Host
impl<Txn> TryCastFrom<State<Txn>> for Host
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Id
impl<Txn> TryCastFrom<State<Txn>> for Id
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for IdRef
impl<Txn> TryCastFrom<State<Txn>> for IdRef
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for InstanceClass
impl<Txn> TryCastFrom<State<Txn>> for InstanceClass
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<InstanceClass>
fn opt_cast_from(state: State<Txn>) -> Option<InstanceClass>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Link
impl<Txn> TryCastFrom<State<Txn>> for Link
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn, T> TryCastFrom<State<Txn>> for Map<T>where
T: TryCastFrom<State<Txn>>,
impl<Txn, T> TryCastFrom<State<Txn>> for Map<T>where
T: TryCastFrom<State<Txn>>,
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Number
impl<Txn> TryCastFrom<State<Txn>> for Number
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for OpDef
impl<Txn> TryCastFrom<State<Txn>> for OpDef
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for OpRef
impl<Txn> TryCastFrom<State<Txn>> for OpRef
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Scalar
impl<Txn> TryCastFrom<State<Txn>> for Scalar
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for TCPathBuf
impl<Txn> TryCastFrom<State<Txn>> for TCPathBuf
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for TCString
impl<Txn> TryCastFrom<State<Txn>> for TCString
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn, T> TryCastFrom<State<Txn>> for Tuple<T>where
T: TryCastFrom<State<Txn>>,
impl<Txn, T> TryCastFrom<State<Txn>> for Tuple<T>where
T: TryCastFrom<State<Txn>>,
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for Value
impl<Txn> TryCastFrom<State<Txn>> for Value
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn, T: TryCastFrom<State<Txn>>> TryCastFrom<State<Txn>> for Vec<T>
impl<Txn, T: TryCastFrom<State<Txn>>> TryCastFrom<State<Txn>> for Vec<T>
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for bool
impl<Txn> TryCastFrom<State<Txn>> for bool
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for u64
impl<Txn> TryCastFrom<State<Txn>> for u64
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<Txn> TryCastFrom<State<Txn>> for usize
impl<Txn> TryCastFrom<State<Txn>> for usize
Source§fn can_cast_from(state: &State<Txn>) -> bool
fn can_cast_from(state: &State<Txn>) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(state: State<Txn>) -> Option<Self>
fn opt_cast_from(state: State<Txn>) -> Option<Self>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Auto Trait Implementations§
impl<Txn> Freeze for State<Txn>
impl<Txn> RefUnwindSafe for State<Txn>where
Txn: RefUnwindSafe,
impl<Txn> Send for State<Txn>where
Txn: Send,
impl<Txn> Sync for State<Txn>where
Txn: Sync,
impl<Txn> Unpin for State<Txn>where
Txn: Unpin,
impl<Txn> UnwindSafe for State<Txn>where
Txn: UnwindSafe + RefUnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> Match for F
impl<F> Match for F
Source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.Source§impl<State, T> Public<State> for T
impl<State, T> Public<State> for T
fn get<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value,
) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value,
value: State,
) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn post<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
params: Map<State>,
) -> Pin<Box<dyn Future<Output = Result<State, TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
fn delete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
txn: &'life1 <State as StateInstance>::Txn,
path: &'life2 [Id],
key: Value,
) -> Pin<Box<dyn Future<Output = Result<(), TCError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
T: 'async_trait,
Source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
Source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.Source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.Source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
Source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.Source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.Source§fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err>where
OnErr: FnOnce(&Self) -> Err,
Returns
Ok(T)
if self
can be cast into T
, otherwise calls on_err
.