Struct Bottle

Source
pub struct Bottle<W>(/* private fields */);
Expand description

Water Bottle.

The Bottle must be held and used, otherwise it will Shatter.

Allows to access Water that was produced by melting Ice.

Implementations§

Source§

impl<W> Bottle<W>

Source

pub fn open(&self) -> W

Opens the Bottle, granting access to Water.

The Bottle is consumed in the process.

§Blocking

This operation blocks till the Heater is done melting Ice.

§Panics
  • When the Bottle has already been opened.
  • When the Bottle is Poisoned1. Poisoning1 happens when Heater melting the Ice fails. Irrecoverable.

1 - Not to be confused with Poisoning of the Mutex, although Bottle is Poisoned because of a very similar reason - panic in a thread.

Trait Implementations§

Source§

impl<T> Drop for Bottle<T>

Source§

fn drop(&mut self)

Drops the Bottle.

§Panics

When Bottle is dropped without ever being used. This causes it to shatter.

It is completely user’s responsibility to ensure that bottle is not dropped without being used.

Auto Trait Implementations§

§

impl<W> !Freeze for Bottle<W>

§

impl<W> !RefUnwindSafe for Bottle<W>

§

impl<W> Send for Bottle<W>
where W: Send,

§

impl<W> !Sync for Bottle<W>

§

impl<W> Unpin for Bottle<W>

§

impl<W> UnwindSafe for Bottle<W>

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.