Struct Resource

Source
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,

Source

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.

Source

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.

Source

pub fn count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone

Return the current available count of the resource.

Source

pub fn count_stats( resource: Grc<Self>, ) -> impl Event<Item = TimingStats<isize>> + Clone

Return the statistics for available count of the resource.

Source

pub fn count_changed(&self) -> impl Observable<Message = isize> + Clone

Notifies when the count property changes.

Source

pub fn count_changed_(&self) -> impl Observable<Message = ()> + Clone

Notifies when the count property changes.

Source

pub fn util_count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone

Return the current utilization count of the resource.

Source

pub fn util_count_stats( resource: Grc<Self>, ) -> impl Event<Item = TimingStats<isize>> + Clone

Return the statistics for utilization count of the resource.

Source

pub fn util_count_changed(&self) -> impl Observable<Message = isize> + Clone

Notifies when the util_count property changes.

Source

pub fn util_count_changed_(&self) -> impl Observable<Message = ()> + Clone

Notifies when the util_count property changes.

Source

pub fn queue_count(resource: Grc<Self>) -> impl Event<Item = isize> + Clone

Return the current queue length of the resource.

Source

pub fn queue_count_stats( resource: Grc<Self>, ) -> impl Event<Item = TimingStats<isize>> + Clone

Return the statistics for queue length of the resource.

Source

pub fn queue_count_changed(&self) -> impl Observable<Message = isize> + Clone

Notifies when the queue_count property changes.

Source

pub fn queue_count_changed_(&self) -> impl Observable<Message = ()> + Clone

Notifies when the queue_count property changes.

Source

pub fn total_wait_time(resource: Grc<Self>) -> impl Event<Item = f64> + Clone

Return the total wait time of the resource.

Source

pub fn wait_time( resource: Grc<Self>, ) -> impl Event<Item = SamplingStats<f64>> + Clone

Return the statistics for wait time of the resource.

Source

pub fn wait_time_changed( &self, ) -> impl Observable<Message = SamplingStats<f64>> + Clone

Notifies when the wait_time property changes.

Source

pub fn wait_time_changed_(&self) -> impl Observable<Message = ()> + Clone

Notifies when the wait_time property changes.

Source

pub fn changed_(&self) -> impl Observable<Message = ()> + Clone

Triggered when one of the Resource properties changes.

Source

pub fn reset(resource: Grc<Self>) -> impl Event<Item = ()> + Clone

Reset the statistics.

Trait Implementations§

Source§

impl<S> PartialEq for Resource<S>
where S: QueueStrategy,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<S> Eq for Resource<S>
where S: QueueStrategy,

Auto Trait Implementations§

§

impl<S> !Freeze for Resource<S>

§

impl<S> !RefUnwindSafe for Resource<S>

§

impl<S> !Send for Resource<S>

§

impl<S> !Sync for Resource<S>

§

impl<S> Unpin for Resource<S>

§

impl<S> !UnwindSafe for Resource<S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V