pub struct Activity { /* private fields */ }Expand description
An activity in a scheduling model.
Implementations§
Source§impl Activity
impl Activity
Sourcepub fn new(id: ActivityId, name: impl Into<String>, interval: Interval) -> Self
pub fn new(id: ActivityId, name: impl Into<String>, interval: Interval) -> Self
Creates a new activity with id, name, interval, and initial demands.
§Complexity
Time & Space: O(1) or O(N) for string / demands allocation.
Sourcepub fn require_resource(&mut self, resource_id: ResourceId, demand: u32)
pub fn require_resource(&mut self, resource_id: ResourceId, demand: u32)
Adds a resource demand requirement to this activity.
Time complexity: O(1) amortized.
Sourcepub fn id(&self) -> ActivityId
pub fn id(&self) -> ActivityId
Returns the activity identifier.
Time complexity: O(1).
Sourcepub fn interval(&self) -> &Interval
pub fn interval(&self) -> &Interval
Returns a reference to the activity’s interval.
Time complexity: O(1).
Sourcepub fn demands(&self) -> &[ResourceDemand]
pub fn demands(&self) -> &[ResourceDemand]
Returns the resource demands.
Time complexity: O(1).
Trait Implementations§
impl Eq for Activity
impl StructuralPartialEq for Activity
Auto Trait Implementations§
impl Freeze for Activity
impl RefUnwindSafe for Activity
impl Send for Activity
impl Sync for Activity
impl Unpin for Activity
impl UnsafeUnpin for Activity
impl UnwindSafe for Activity
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
Mutably borrows from an owned value. Read more