pub struct Resource<S>where
S: QueueStrategy,{ /* private fields */ }
Expand description
Represents a simple resource that gathers its statistics.
Implementations§
Source§impl<S> Resource<S>where
S: QueueStrategy,
impl<S> Resource<S>where
S: QueueStrategy,
Sourcepub fn new(strategy: S, count: isize) -> NewResource<S>
pub fn new(strategy: S, count: isize) -> NewResource<S>
Create a new resource by the specified queue storage and initial count, where the latter becomes the capacity as well.
Sourcepub fn new_with_max_count(
strategy: S,
count: isize,
max_count: Option<isize>,
) -> NewResource<S>
pub fn new_with_max_count( strategy: S, count: isize, max_count: Option<isize>, ) -> NewResource<S>
Create a new resource by the specified queue storage, initial count and optional maximum count, i.e. capacity.
Sourcepub fn count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone
pub fn count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone
Return the current available count of the resource.
Sourcepub fn count_stats(
resource: Grc<Self>,
) -> impl Event<Item = TimingStats<isize>> + Clone
pub fn count_stats( resource: Grc<Self>, ) -> impl Event<Item = TimingStats<isize>> + Clone
Return the statistics for available count of the resource.
Sourcepub fn count_changed(&self) -> impl Observable<Message = isize> + Clone
pub fn count_changed(&self) -> impl Observable<Message = isize> + Clone
Notifies when the count
property changes.
Sourcepub fn count_changed_(&self) -> impl Observable<Message = ()> + Clone
pub fn count_changed_(&self) -> impl Observable<Message = ()> + Clone
Notifies when the count
property changes.
Sourcepub fn util_count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone
pub fn util_count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone
Return the current utilization count of the resource.
Sourcepub fn util_count_stats(
resource: Grc<Self>,
) -> impl Event<Item = TimingStats<isize>> + Clone
pub fn util_count_stats( resource: Grc<Self>, ) -> impl Event<Item = TimingStats<isize>> + Clone
Return the statistics for utilization count of the resource.
Sourcepub fn util_count_changed(&self) -> impl Observable<Message = isize> + Clone
pub fn util_count_changed(&self) -> impl Observable<Message = isize> + Clone
Notifies when the util_count
property changes.
Sourcepub fn util_count_changed_(&self) -> impl Observable<Message = ()> + Clone
pub fn util_count_changed_(&self) -> impl Observable<Message = ()> + Clone
Notifies when the util_count
property changes.
Sourcepub fn queue_count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone
pub fn queue_count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone
Return the current queue length of the resource.
Sourcepub fn queue_count_stats(
resource: Grc<Self>,
) -> impl Event<Item = TimingStats<isize>> + Clone
pub fn queue_count_stats( resource: Grc<Self>, ) -> impl Event<Item = TimingStats<isize>> + Clone
Return the statistics for queue length of the resource.
Sourcepub fn queue_count_changed(&self) -> impl Observable<Message = isize> + Clone
pub fn queue_count_changed(&self) -> impl Observable<Message = isize> + Clone
Notifies when the queue_count
property changes.
Sourcepub fn queue_count_changed_(&self) -> impl Observable<Message = ()> + Clone
pub fn queue_count_changed_(&self) -> impl Observable<Message = ()> + Clone
Notifies when the queue_count
property changes.
Sourcepub fn total_wait_time(resource: Grc<Self>) -> impl Event<Item = f64> + Clone
pub fn total_wait_time(resource: Grc<Self>) -> impl Event<Item = f64> + Clone
Return the total wait time of the resource.
Sourcepub fn wait_time(
resource: Grc<Self>,
) -> impl Event<Item = SamplingStats<f64>> + Clone
pub fn wait_time( resource: Grc<Self>, ) -> impl Event<Item = SamplingStats<f64>> + Clone
Return the statistics for wait time of the resource.
Sourcepub fn wait_time_changed(
&self,
) -> impl Observable<Message = SamplingStats<f64>> + Clone
pub fn wait_time_changed( &self, ) -> impl Observable<Message = SamplingStats<f64>> + Clone
Notifies when the wait_time
property changes.
Sourcepub fn wait_time_changed_(&self) -> impl Observable<Message = ()> + Clone
pub fn wait_time_changed_(&self) -> impl Observable<Message = ()> + Clone
Notifies when the wait_time
property changes.
Sourcepub fn changed_(&self) -> impl Observable<Message = ()> + Clone
pub fn changed_(&self) -> impl Observable<Message = ()> + Clone
Triggered when one of the Resource
properties changes.