pub enum Aggregator {
None,
Some(SubAggregator),
Take(SubAggregator),
Or(SubAggregator, SubAggregator),
AluVM(LibSite),
}
Expand description
A set of pre-defined top-level state aggregators (see crate::Api::aggregators
.
Variants§
None
Produces constant value of Option::None
type.
Some(SubAggregator)
Wrap into an optional value.
If the underlying aggregated state fails, sets the aggregated state to None
.
Take(SubAggregator)
Takes the underlying aggregated state and applies nothing on top.
If the underlying aggregator fails, the aggregated state is not produced.
Or(SubAggregator, SubAggregator)
If the underlying aggregated state fails, returns the other state.
If the other state fails, the aggregated state is not produced.
AluVM(LibSite)
Execute a custom function on the state.
Tuple Fields
0: LibSite
The entry point to the script (virtual machine uses libraries from
crate::Semantics
).
Implementations§
Source§impl Aggregator
impl Aggregator
Sourcepub fn depends_on(&self) -> impl Iterator<Item = &StateName>
pub fn depends_on(&self) -> impl Iterator<Item = &StateName>
Returns names of the other computed state which this aggregator depends on and which needs to be computed before running this aggregator.
Sourcepub fn aggregate<'libs>(
&self,
global: &BTreeMap<StateName, BTreeMap<CellAddr, StateAtom>>,
aggregated: &BTreeMap<StateName, StrictVal>,
libs: impl IntoIterator<Item = &'libs Lib>,
types: &TypeSystem,
) -> Option<StrictVal>
pub fn aggregate<'libs>( &self, global: &BTreeMap<StateName, BTreeMap<CellAddr, StateAtom>>, aggregated: &BTreeMap<StateName, StrictVal>, libs: impl IntoIterator<Item = &'libs Lib>, types: &TypeSystem, ) -> Option<StrictVal>
Compute state via applying some aggregator function.
§Returns
Aggregated state value. If the computing fails due to any exception, None
.
Trait Implementations§
Source§impl Clone for Aggregator
impl Clone for Aggregator
Source§fn clone(&self) -> Aggregator
fn clone(&self) -> Aggregator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Aggregator
impl Debug for Aggregator
Source§impl<'de> Deserialize<'de> for Aggregator
impl<'de> Deserialize<'de> for Aggregator
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for Aggregator
impl Hash for Aggregator
Source§impl Ord for Aggregator
impl Ord for Aggregator
Source§fn cmp(&self, other: &Aggregator) -> Ordering
fn cmp(&self, other: &Aggregator) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Aggregator
impl PartialEq for Aggregator
Source§impl PartialOrd for Aggregator
impl PartialOrd for Aggregator
Source§impl Serialize for Aggregator
impl Serialize for Aggregator
Source§impl StrictDecode for Aggregator
impl StrictDecode for Aggregator
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for Aggregator
impl StrictDumb for Aggregator
fn strict_dumb() -> Self
Source§impl StrictEncode for Aggregator
impl StrictEncode for Aggregator
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictSum for Aggregator
impl StrictSum for Aggregator
const ALL_VARIANTS: &'static [(u8, &'static str)]
fn variant_name(&self) -> &'static str
fn strict_check_variants()
fn variant_name_by_tag(tag: u8) -> Option<VariantName>
fn variant_ord(&self) -> u8
Source§impl StrictType for Aggregator
impl StrictType for Aggregator
const STRICT_LIB_NAME: &'static str = LIB_NAME_SONIC
fn strict_name() -> Option<TypeName>
Source§impl StrictUnion for Aggregator
impl StrictUnion for Aggregator
fn strict_type_info() -> TypeInfo<Self>
impl Eq for Aggregator
impl StructuralPartialEq for Aggregator
Auto Trait Implementations§
impl Freeze for Aggregator
impl RefUnwindSafe for Aggregator
impl Send for Aggregator
impl Sync for Aggregator
impl Unpin for Aggregator
impl UnwindSafe for Aggregator
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.