pub struct MaybeUnset<T> { /* private fields */ }

Implementations§

source§

impl<T> MaybeUnset<T>

source

pub fn new(default: T) -> Self

source

pub fn new_or(default: T, value: Option<T>) -> Self

source

pub fn is_set(&self) -> bool

source

pub fn set(&mut self, value: T)

source

pub fn try_set(&mut self, value: Option<T>)

Will set the value if value is Some. If value is None, the state of the object is unchanged.

source

pub fn set_if_unset(&mut self, value: T) -> bool

Only sets the value if the set flag is false. Returns whether a new value was set.

source

pub fn try_set_if_unset(&mut self, value: Option<T>) -> bool

Only sets the value if the set flag is false and value is Some. Returns whether a new value was set.

source

pub fn get(&self) -> &T

source

pub fn try_get(&self) -> Option<&T>

Will return a Some only if the value has been set.

source

pub fn unwrap(self) -> T

source

pub fn map<U, P: FnOnce(T) -> U>(self, f: P) -> MaybeUnset<U>

source§

impl<T: Clone> MaybeUnset<T>

source

pub fn get_cloned(&self) -> T

source

pub fn cloned(&self) -> Self

source§

impl<T: Copy> MaybeUnset<T>

source

pub fn get_copied(&self) -> T

source

pub fn copied(&self) -> Self

Trait Implementations§

source§

impl<T> AsRef<T> for MaybeUnset<T>

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: Clone> Clone for MaybeUnset<T>

source§

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

Returns a copy 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 MaybeUnset<T>

source§

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

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

impl<T: Default> Default for MaybeUnset<T>

source§

fn default() -> Self

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

impl<T> Deref for MaybeUnset<T>

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl From<MaybeUnset<LineType>> for AssociatedData

source§

fn from(value: MaybeUnset<LineType>) -> Self

Converts to this type from the input type.
source§

impl From<MaybeUnset<Style>> for AssociatedData

source§

fn from(value: MaybeUnset<Style>) -> Self

Converts to this type from the input type.
source§

impl From<MaybeUnset<bool>> for AssociatedData

source§

fn from(value: MaybeUnset<bool>) -> Self

Converts to this type from the input type.
source§

impl<T: Copy> Copy for MaybeUnset<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for MaybeUnset<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> CloneWithNode for T
where T: Clone,

source§

fn clone_with_node(&mut self) -> T

source§

fn clone_without_node(&self) -> T

source§

impl<T> Convert for T

source§

fn convert<U>(self, context: &CompileContext) -> Expr<U>
where U: ConvertFrom<T>,

Errors Read more
source§

fn can_convert<U>(&self) -> bool
where U: ConvertFrom<T>,

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

§

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

§

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

§

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.
§

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

§

fn vzip(self) -> V