pub enum Operator<T> {
Agent(Agent<T>),
Observer(Observer<T>),
}Expand description
Enumerates the varios operators for the nodes, reducing the number of generics needed.
Variants§
Implementations§
Source§impl<T> Operator<T>
impl<T> Operator<T>
Sourcepub const fn is_agent(&self) -> bool
pub const fn is_agent(&self) -> bool
Returns true if the enum is Operator::Agent otherwise false
Sourcepub const fn is_observer(&self) -> bool
pub const fn is_observer(&self) -> bool
Returns true if the enum is Operator::Observer otherwise false
Source§impl<T> Operator<T>
impl<T> Operator<T>
Sourcepub fn active_operator<D>(&self) -> &dyn Actor<D, T>
pub fn active_operator<D>(&self) -> &dyn Actor<D, T>
Get the current active operator as Actor trait object
Sourcepub fn active_operator_mut<D>(&mut self) -> &mut dyn Actor<D, T>
pub fn active_operator_mut<D>(&mut self) -> &mut dyn Actor<D, T>
Get the current active operator as Actor trait object (mutable)
Trait Implementations§
Source§impl<D, T> Actor<D, T> for Operator<T>
impl<D, T> Actor<D, T> for Operator<T>
Source§fn initialize(&mut self) -> Result<(), ActorError>
fn initialize(&mut self) -> Result<(), ActorError>
Initialize the actor with required resources
Source§fn process_transform(
&mut self,
transform: LPR,
driver: &mut D,
memory: &mut TopoLedger<T>,
) -> Result<bool, ActorError>
fn process_transform( &mut self, transform: LPR, driver: &mut D, memory: &mut TopoLedger<T>, ) -> Result<bool, ActorError>
Process a transformation request and determine response
Source§fn process_message(
&mut self,
source: IndexBase<usize, EdgeIndex>,
message: &[u8],
memory: &mut TopoLedger<T>,
) -> Result<(), ActorError>
fn process_message( &mut self, source: IndexBase<usize, EdgeIndex>, message: &[u8], memory: &mut TopoLedger<T>, ) -> Result<(), ActorError>
Process incoming message from another node
Source§fn on_activate(
&mut self,
driver: &D,
memory: &mut TopoLedger<T>,
) -> Result<(), ActorError>
fn on_activate( &mut self, driver: &D, memory: &mut TopoLedger<T>, ) -> Result<(), ActorError>
Called when the node enters this actor mode
Source§fn on_deactivate(
&mut self,
driver: &D,
memory: &mut TopoLedger<T>,
) -> Result<(), ActorError>
fn on_deactivate( &mut self, driver: &D, memory: &mut TopoLedger<T>, ) -> Result<(), ActorError>
Called when the node leaves this actor mode
Source§fn resource_requirements(&self) -> (usize, usize)
fn resource_requirements(&self) -> (usize, usize)
Calculate resource requirements for this actor mode
Source§fn allows_pattern_sharing(&self) -> bool
fn allows_pattern_sharing(&self) -> bool
Whether this actor allows pattern sharing
Source§fn contextualize(
&self,
driver: &D,
memory: &TopoLedger<T>,
) -> Result<ActorContext<T>, ActorError>
fn contextualize( &self, driver: &D, memory: &TopoLedger<T>, ) -> Result<ActorContext<T>, ActorError>
Derive contextual meaning from current state
Source§impl<'_enum, T> From<&'_enum Operator<T>> for OperatorKind
impl<'_enum, T> From<&'_enum Operator<T>> for OperatorKind
Source§fn from(val: &'_enum Operator<T>) -> OperatorKind
fn from(val: &'_enum Operator<T>) -> OperatorKind
Converts to this type from the input type.
Source§impl<T> From<Operator<T>> for OperatorKind
impl<T> From<Operator<T>> for OperatorKind
Source§fn from(val: Operator<T>) -> OperatorKind
fn from(val: Operator<T>) -> OperatorKind
Converts to this type from the input type.
Source§impl<T> IntoDiscriminant for Operator<T>
impl<T> IntoDiscriminant for Operator<T>
Source§type Discriminant = OperatorKind
type Discriminant = OperatorKind
Enum listing the same variants as this enum but without any data fields
fn discriminant(&self) -> <Operator<T> as IntoDiscriminant>::Discriminant
impl<T> Eq for Operator<T>where
T: Eq,
impl<T> StructuralPartialEq for Operator<T>
Auto Trait Implementations§
impl<T> Freeze for Operator<T>where
T: Freeze,
impl<T> RefUnwindSafe for Operator<T>where
T: RefUnwindSafe,
impl<T> Send for Operator<T>where
T: Send,
impl<T> Sync for Operator<T>where
T: Sync,
impl<T> Unpin for Operator<T>where
T: Unpin,
impl<T> UnwindSafe for Operator<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
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<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
Compare self to
key and return true if they are equal.Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
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 moreSource§impl<T> IntoWeight<T> for T
impl<T> IntoWeight<T> for T
fn into_weight(self) -> Weight<T>
Source§impl<A, B, C> PercentDifference<B> for A
impl<A, B, C> PercentDifference<B> for A
type Output = C
Source§fn percent_diff(self, rhs: B) -> <A as PercentDifference<B>>::Output
fn percent_diff(self, rhs: B) -> <A as PercentDifference<B>>::Output
Computes the percent difference between two values.