Skip to main content

LogosOpt

Struct LogosOpt 

Source
pub struct LogosOpt<T>(pub Option<T>);
Expand description

A value of T, or nothing.

Tuple Fields§

§0: Option<T>

Implementations§

Source§

impl<T> LogosOpt<T>

Source

pub const NOTHING: Self

nothing.

Source

pub fn is_nothing(&self) -> bool

Whether it holds nothing.

Source

pub fn held(&self, failure: &str) -> &T

The value it holds. Holding nothing, the program stops with failure.

Source

pub fn held_mut(&mut self, failure: &str) -> &mut T

The value it holds, to change in place. Holding nothing, the program stops with failure.

Source

pub fn into_held(self, failure: &str) -> T

The value it holds, taken. Holding nothing, the program stops with failure.

Source

pub fn pair<U>( left: LogosOpt<T>, right: LogosOpt<U>, failures: [&str; 3], ) -> (T, U)

The values two operands hold, for an operation on both, each evaluated before either is read. Either holding nothing, the program stops with failures: the words for the left one alone, the right one alone, and both.

Source

pub fn equals_with<U>( &self, other: &LogosOpt<U>, same: impl FnOnce(&T, &U) -> bool, ) -> bool

Whether self and other are one value: both nothing, or two values same finds equal.

Trait Implementations§

Source§

impl<T: Clone> Clone for LogosOpt<T>

Source§

fn clone(&self) -> LogosOpt<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for LogosOpt<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for LogosOpt<T>

A place starts holding its type’s own first value, as the VM’s does.

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> From<T> for LogosOpt<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for LogosOpt<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for LogosOpt<T>

Source§

fn eq(&self, other: &LogosOpt<T>) -> 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<T: Truthy> Truthy for LogosOpt<T>

nothing is false where a condition reads it, and a value is as true as it is.

Source§

fn truthy(&self) -> bool

Source§

impl<T: Eq> Eq for LogosOpt<T>

Source§

impl<T> StructuralPartialEq for LogosOpt<T>

Auto Trait Implementations§

§

impl<T> Freeze for LogosOpt<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for LogosOpt<T>
where T: RefUnwindSafe,

§

impl<T> Send for LogosOpt<T>
where T: Send,

§

impl<T> Sync for LogosOpt<T>
where T: Sync,

§

impl<T> Unpin for LogosOpt<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for LogosOpt<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for LogosOpt<T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.