pub struct Resource { /* private fields */ }Expand description
A resource with a defined capacity.
Implementations§
Source§impl Resource
impl Resource
Sourcepub fn new(id: ResourceId, name: impl Into<String>, capacity: u32) -> Self
pub fn new(id: ResourceId, name: impl Into<String>, capacity: u32) -> Self
Creates a new resource with given id, name, and capacity.
§Complexity
Time: O(1) or O(N) for name allocation. Space: O(N) where N is name length.
Sourcepub fn id(&self) -> ResourceId
pub fn id(&self) -> ResourceId
Returns the unique resource identifier.
Time complexity: O(1).
Trait Implementations§
impl Eq for Resource
impl StructuralPartialEq for Resource
Auto Trait Implementations§
impl Freeze for Resource
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnsafeUnpin for Resource
impl UnwindSafe for Resource
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