pub struct ActorContext<T = f32> { /* private fields */ }Expand description
The context for node operators; the context provides information about the current state of the operator and its environment.
Implementations§
Source§impl<T> ActorContext<T>
impl<T> ActorContext<T>
Sourcepub fn new() -> ActorContext<T>where
T: Zero,
pub fn new() -> ActorContext<T>where
T: Zero,
Create a new context with default values
Sourcepub const fn harmonic_function(&self) -> Option<HarmonicFunction>
pub const fn harmonic_function(&self) -> Option<HarmonicFunction>
returns a copy of the harmonic function
Sourcepub const fn metric_position(&self) -> Option<MetricPosition>
pub const fn metric_position(&self) -> Option<MetricPosition>
returns a copy of the metric position
returns an immutable reference to the semantic tags
returns a mutable reference to the semantic tags
Sourcepub fn set_harmonic_function(&mut self, function: Option<HarmonicFunction>)
pub fn set_harmonic_function(&mut self, function: Option<HarmonicFunction>)
Set the harmonic function
Sourcepub fn set_metric_position(&mut self, position: Option<MetricPosition>)
pub fn set_metric_position(&mut self, position: Option<MetricPosition>)
Set the metric position
Sourcepub fn push_semantic_tag(&mut self, tag: String)
pub fn push_semantic_tag(&mut self, tag: String)
Add a semantic tag
Sourcepub fn set_stability(&mut self, stability: T)
pub fn set_stability(&mut self, stability: T)
Set the stability rating
Sourcepub fn with_harmonic_function(
self,
function: HarmonicFunction,
) -> ActorContext<T>
pub fn with_harmonic_function( self, function: HarmonicFunction, ) -> ActorContext<T>
consumes the current instance to create another with the given harmonic function
Sourcepub fn with_metric_position(self, position: MetricPosition) -> ActorContext<T>
pub fn with_metric_position(self, position: MetricPosition) -> ActorContext<T>
consumes the current instance to create another with the given metric position
consumes the current instance to create another with the given semantic tags
Sourcepub fn with_stability(self, stability: T) -> ActorContext<T>
pub fn with_stability(self, stability: T) -> ActorContext<T>
consumes the current instance to create another with the given stability rating
Trait Implementations§
Source§impl<T> Clone for ActorContext<T>where
T: Clone,
impl<T> Clone for ActorContext<T>where
T: Clone,
Source§fn clone(&self) -> ActorContext<T>
fn clone(&self) -> ActorContext<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for ActorContext<T>where
T: Debug,
impl<T> Debug for ActorContext<T>where
T: Debug,
Source§impl Default for ActorContext
impl Default for ActorContext
Source§fn default() -> ActorContext
fn default() -> ActorContext
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for ActorContext<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ActorContext<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActorContext<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ActorContext<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Hash for ActorContext<T>where
T: Hash,
impl<T> Hash for ActorContext<T>where
T: Hash,
Source§impl<T> Ord for ActorContext<T>where
T: Ord,
impl<T> Ord for ActorContext<T>where
T: Ord,
Source§fn cmp(&self, other: &ActorContext<T>) -> Ordering
fn cmp(&self, other: &ActorContext<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T> PartialEq for ActorContext<T>where
T: PartialEq,
impl<T> PartialEq for ActorContext<T>where
T: PartialEq,
Source§impl<T> PartialOrd for ActorContext<T>where
T: PartialOrd,
impl<T> PartialOrd for ActorContext<T>where
T: PartialOrd,
Source§impl<T> Serialize for ActorContext<T>where
T: Serialize,
impl<T> Serialize for ActorContext<T>where
T: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Eq for ActorContext<T>where
T: Eq,
impl<T> StructuralPartialEq for ActorContext<T>
Auto Trait Implementations§
impl<T> Freeze for ActorContext<T>where
T: Freeze,
impl<T> RefUnwindSafe for ActorContext<T>where
T: RefUnwindSafe,
impl<T> Send for ActorContext<T>where
T: Send,
impl<T> Sync for ActorContext<T>where
T: Sync,
impl<T> Unpin for ActorContext<T>where
T: Unpin,
impl<T> UnwindSafe for ActorContext<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> 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§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.