Skip to main content

Lunit

Struct Lunit 

Source
pub struct Lunit(/* private fields */);
Available on crate feature ui only.
Expand description

🧱 📏 Fixed-point scalar used for UI layout negotiation.


📍 ui/layout::Lunit

📦 size_of::<Lunit>() == 4 bytes / 32 bits ⚗️Option<T> ❗🟰 T


Lunit is expressed in logical layout space. It is not a device pixel, physical pixel, terminal cell, typographic point, or real-world length.

Backend projection maps it to physical pixels, terminal cells, or other output units.

Implementations§

Source§

impl Lunit

Source

pub const CARRIER_BITS: u32 = i32::BITS

Number of bits in the primitive carrier.

Source

pub const VALUE_BITS: u32

Number of bits used by the signed payload.

Source

pub const META_BITS: u32

Number of high bits used by boundary metadata.

Source

pub const DIR_BITS: u32 = 1

Number of metadata bits used by the boundary direction marker.

Source

pub const COUNT_BITS: u32

Number of metadata bits used by the saturating boundary-event counter.

Source

pub const MAX_COUNT: u32

Maximum representable boundary-event count.

Source

pub const IS_SIGNED: bool = true

Whether the payload carrier is signed.

Source

pub const IS_SYMMETRIC: bool = true

Whether the signed payload range is symmetric around zero.

Source

pub const MIN_VALUE: i32 = Self::_MIN_VALUE

Minimum representable payload value.

Source

pub const MAX_VALUE: i32 = Self::_MAX_VALUE

Maximum representable payload value.

Source

pub const ZERO: Self

Zero, with empty metadata.

Source

pub const MIN: Self

Minimum payload value, with empty metadata.

Source

pub const MAX: Self

Maximum payload value, with empty metadata.

Source

pub const fn new(value: i32) -> Self

Creates a value, saturating to the payload range.

If value is below MIN_VALUE, the result is clamped to MIN and records one lower-boundary event.

If value is above MAX_VALUE, the result is clamped to MAX and records one upper-boundary event.

Source

pub const fn new_checked(value: i32) -> Option<Self>

Creates a value if it fits in the payload range.

Source

pub const fn new_saturated(value: i32) -> Self

Creates a value saturated to the payload range.

Source

pub const fn new_saturated_up(value: i64) -> Self

Creates a value saturated to the payload range, from an upcasted carrier.

Source

pub const fn from_raw(raw: i32) -> Option<Self>

Creates a value from a raw encoded carrier.

Returns None if raw is reserved, invalid for the underlying representation, or decodes outside the payload range.

Non-canonical raw encodings with count == 0 are canonicalized so the direction bit is cleared.

Source

pub const fn raw(self) -> i32

Returns the raw encoded carrier.

Source

pub const fn get(self) -> i32

Returns the decoded payload value.

Source

pub const fn is_bounded(self) -> bool

Returns whether this value carries at least one boundary event.

Source

pub const fn bound_count(self) -> u32

Returns the saturating boundary-event count.

A value of 0 means no boundary event is recorded. When this is 0, bound_dir returns None.

Source

pub const fn bound_dir(self) -> Option<Boundary1d>

Returns the last recorded boundary direction.

Returns None when bound_count is 0.

Source

pub const fn clear_meta(self) -> Self

Returns the same payload value with empty metadata.

Source

pub const fn with_bound_meta(self, count: u32, dir: Option<Boundary1d>) -> Self

Returns the same payload value with explicit boundary metadata.

count saturates to MAX_COUNT.

When count == 0, dir is ignored and the raw direction bit is canonicalized to zero.

Source

pub const fn is_negative(self) -> bool

Whether the value is less than zero.

Source

pub const fn is_positive(self) -> bool

Whether the value is greater than zero.

Source

pub const fn is_zero(self) -> bool

Whether the value is zero.

Source

pub const fn is_nonnegative(self) -> bool

Whether the value is greater than or equal to zero.

Source

pub const fn is_nonpositive(self) -> bool

Whether the value is less than or equal to zero.

Source

pub const fn eq(self, other: Self) -> bool

Equality comparison over decoded payload values.

Source

pub const fn cmp(self, other: Self) -> Ordering

Compares decoded payload values.

Source

pub const fn max(self, other: Self) -> Self

Returns the greater decoded value.

Metadata is cleared because the result is recomputed.

Source

pub const fn max_meta(self, other: Self) -> Self

Returns the greater value, preserving the selected operand metadata.

Source

pub const fn max_zero(self) -> Self

Returns the decoded value floored at zero.

Metadata is cleared because the result is recomputed.

Source

pub const fn max_zero_meta(self) -> Self

Returns the decoded value floored at zero, preserving selected metadata.

Source

pub const fn min(self, other: Self) -> Self

Returns the lesser decoded value.

Metadata is cleared because the result is recomputed.

Source

pub const fn min_meta(self, other: Self) -> Self

Returns the lesser value, preserving the selected operand metadata.

Source

pub const fn min_zero(self) -> Self

Returns the decoded value capped at zero.

Metadata is cleared because the result is recomputed.

Source

pub const fn min_zero_meta(self) -> Self

Returns the decoded value capped at zero, preserving selected metadata.

Source

pub const fn clamp(self, min: Self, max: Self) -> Self

Clamps the decoded value between min and max.

Metadata is cleared because the result is recomputed.

If min > max, this returns min.

Source

pub const fn clamp_meta(self, min: Self, max: Self) -> Self

Clamps self between min and max, preserving selected metadata.

If min > max, this returns min.

Source§

impl Lunit

Source

pub const QUANTA_PER_LOGICAL_PX: i32 = 120

Number of internal layout quanta per logical UI pixel.

Source

pub const fn px(px: i32) -> Self

Creates a layout scalar from whole logical UI pixels.

Saturates if the scaled value escapes the payload range.

Source

pub const fn px_frac(num: i32, den: i32) -> Self

Creates a layout scalar from a fraction of a logical UI pixel.

Rounds to the nearest representable quantum and saturates on overflow.

Source

pub const fn from_quanta(quanta: i32) -> Self

Creates a layout scalar from internal layout quanta.

Source

pub const fn quanta(self) -> i32

Returns the number of internal layout quanta.

Source

pub const fn positive_part(self) -> Self

Returns this value clamped below by zero.

Source

pub const fn sub_floor_zero(self, rhs: Self) -> Self

Subtracts rhs, returning zero instead of a negative result.

Source

pub const fn div_floor_i32(self, rhs: i32) -> Self

Divides by an integer, rounding toward negative infinity.

Saturates to the signed endpoint if rhs == 0.

Source

pub const fn div_ceil_i32(self, rhs: i32) -> Self

Divides by an integer, rounding toward positive infinity.

Saturates to the signed endpoint if rhs == 0.

Source

pub const fn div_round_i32(self, rhs: i32) -> Self

Divides by an integer, rounding to the nearest result.

Halfway cases round away from zero. Saturates to the signed endpoint if rhs == 0.

Source

pub const fn split_floor(self, parts: i32) -> Self

Returns the base part size when splitting this value into parts.

Returns zero if parts <= 0.

Source

pub const fn split_remainder(self, parts: i32) -> i32

Returns the quantum remainder when splitting this value into parts.

Returns zero if parts <= 0.

Source§

impl Lunit

Source

pub const fn abs(self) -> Self

Returns the absolute decoded value, saturating to the payload range.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn abs_meta(self) -> Self

Returns the absolute decoded value, preserving boundary metadata.

Inherited metadata is preserved; operation metadata is recorded if this clips.

Source

pub const fn abs_nometa(self) -> Self

Returns the absolute decoded value without metadata.

No metadata is propagated or generated.

Source

pub const fn sat_add(self, rhs: Self) -> Self

Saturating addition.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_add_meta(self, rhs: Self) -> Self

Saturating addition, preserving boundary metadata.

Inherited metadata is merged; operation metadata is recorded if this clips.

Source

pub const fn sat_add_nometa(self, rhs: Self) -> Self

Saturating addition without metadata.

No metadata is propagated or generated.

Source

pub const fn sat_add_floor_zero(self, rhs: Self) -> Self

Adds rhs, saturating to the payload range, then applying a zero floor.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_add_floor_zero_meta(self, rhs: Self) -> Self

Adds rhs, preserving metadata, saturating to the payload range, then applying a zero floor.

Source

pub const fn sat_add_ceil_zero(self, rhs: Self) -> Self

Adds rhs, saturating to the payload range, then applying a zero ceiling.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_add_ceil_zero_meta(self, rhs: Self) -> Self

Adds rhs, preserving metadata, saturating to the payload range, then applying a zero ceiling.

Source

pub const fn sat_sub(self, rhs: Self) -> Self

Saturating subtraction.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_sub_meta(self, rhs: Self) -> Self

Saturating subtraction, preserving boundary metadata.

Inherited metadata is merged; operation metadata is recorded if this clips.

Source

pub const fn sat_sub_nometa(self, rhs: Self) -> Self

Saturating subtraction without metadata.

No metadata is propagated or generated.

Source

pub const fn sat_sub_floor_zero(self, rhs: Self) -> Self

Subtracts rhs, saturating to the payload range, then applying a zero floor.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_sub_floor_zero_meta(self, rhs: Self) -> Self

Subtracts rhs, preserving metadata, saturating to the payload range, then applying a zero floor.

Source

pub const fn sat_sub_ceil_zero(self, rhs: Self) -> Self

Subtracts rhs, saturating to the payload range, then applying a zero ceiling.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_sub_ceil_zero_meta(self, rhs: Self) -> Self

Subtracts rhs, preserving metadata, saturating to the payload range, then applying a zero ceiling.

Source

pub const fn sat_mul(self, rhs: Self) -> Self

Saturating multiplication.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_mul_meta(self, rhs: Self) -> Self

Saturating multiplication, preserving boundary metadata.

Inherited metadata is merged; operation metadata is recorded if this clips.

Source

pub const fn sat_mul_nometa(self, rhs: Self) -> Self

Saturating multiplication without metadata.

No metadata is propagated or generated.

Source

pub const fn sat_mul_div(self, num: i32, den: i32) -> Option<Self>

Multiplies by num, divides by den, and saturates the final result.

Inherited metadata is ignored; operation metadata is recorded if this clips. Returns None when den == 0.

Source

pub const fn sat_mul_div_meta(self, num: i32, den: i32) -> Option<Self>

Multiplies by num, divides by den, and saturates the final result, preserving boundary metadata.

Inherited metadata is merged; operation metadata is recorded if this clips. Returns None when den == 0.

Source

pub const fn sat_mul_div_nometa(self, num: i32, den: i32) -> Option<Self>

Multiplies by num, divides by den, and saturates the final result without metadata.

No metadata is propagated or generated. Returns None when den == 0.

Source

pub const fn sat_dist(self, rhs: Self) -> Self

Returns the absolute distance between decoded values, saturating to the payload range.

Inherited metadata is ignored; operation metadata is recorded if this clips.

Source

pub const fn sat_dist_meta(self, rhs: Self) -> Self

Returns the absolute distance between decoded values, saturating to the payload range.

Inherited metadata is merged; operation metadata is recorded if this clips.

Source

pub const fn sat_dist_nometa(self, rhs: Self) -> Self

Returns the absolute distance between decoded values, saturating to the payload range.

No metadata is propagated or generated.

Source§

impl Lunit

§Checked operations

Source

pub const fn che_add(self, rhs: Self) -> Option<Self>

Checked addition.

Inherited metadata is ignored. Returns None if the exact result escapes the payload range.

Source

pub const fn che_add_meta(self, rhs: Self) -> Option<Self>

Checked addition, preserving boundary metadata.

Inherited metadata is merged when the result fits.

Source

pub const fn che_sub(self, rhs: Self) -> Option<Self>

Checked subtraction.

Inherited metadata is ignored. Returns None if the exact result escapes the payload range.

Source

pub const fn che_sub_meta(self, rhs: Self) -> Option<Self>

Checked subtraction, preserving boundary metadata.

Inherited metadata is merged when the result fits.

Source

pub const fn che_mul(self, rhs: Self) -> Option<Self>

Checked multiplication.

Inherited metadata is ignored. Returns None if the exact result escapes the payload range.

Source

pub const fn che_mul_meta(self, rhs: Self) -> Option<Self>

Checked multiplication, preserving boundary metadata.

Inherited metadata is merged when the result fits.

Source

pub const fn che_mul_div(self, num: i32, den: i32) -> Option<Self>

Multiplies by num, divides by den, and checks the final result.

Inherited metadata is ignored. Returns None when den == 0 or the final result escapes the payload range.

Source

pub const fn che_mul_div_meta(self, num: i32, den: i32) -> Option<Self>

Multiplies by num, divides by den, and checks the final result.

Inherited metadata is merged when the result fits. Returns None when den == 0 or the final result escapes the payload range.

Source

pub const fn che_dist(self, rhs: Self) -> Option<Self>

Returns the absolute distance between the decoded values.

Returns None if the exact distance cannot be represented as a payload value.

Source

pub const fn che_dist_meta(self, rhs: Self) -> Option<Self>

Returns the absolute distance between the decoded values.

Inherited metadata is merged when the result fits. Returns None if the exact distance cannot be represented as a payload value.

Source§

impl Lunit

§Modular operations

Source

pub const fn mod_add(self, delta: Self, modulo: Self) -> Option<Self>

Modular addition over an explicit positive modulus.

Returns (self + delta) mod modulo using Euclidean modulo.

Returns None when modulo <= 0.

Source

pub const fn mod_sub(self, delta: Self, modulo: Self) -> Option<Self>

Modular subtraction over an explicit positive modulus.

Returns (self - delta) mod modulo using Euclidean modulo.

Returns None when modulo <= 0.

Source§

impl Lunit

§Upcasted outcome operations

Source

pub const fn add_up(self, rhs: Self) -> i64

Returns the exact upcasted sum of the decoded values.

Source

pub const fn sub_up(self, rhs: Self) -> i64

Returns the exact upcasted difference of the decoded values.

Source

pub const fn mul_up(self, rhs: Self) -> i64

Returns the exact upcasted product of the decoded values.

Source

pub const fn dist_up(self, rhs: Self) -> i64

Returns the exact absolute distance between the decoded values.

Trait Implementations§

Source§

impl Clone for Lunit

Source§

fn clone(&self) -> Lunit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl ConstInit for Lunit

Source§

const INIT: Self = Self::ZERO

Returns the compile-time “initial value” for a type.
Source§

impl Copy for Lunit

Source§

impl Debug for Lunit

Source§

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

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

impl Default for Lunit

Source§

fn default() -> Self

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

impl Display for Lunit

Source§

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

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

impl Eq for Lunit

Source§

impl Hash for Lunit

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 Ord for Lunit

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Lunit

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<Lunit> for i32

Source§

fn eq(&self, other: &Lunit) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialEq<i32> for Lunit

Source§

fn eq(&self, other: &i32) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Lunit

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

§

impl Freeze for Lunit

§

impl RefUnwindSafe for Lunit

§

impl Send for Lunit

§

impl Sync for Lunit

§

impl Unpin for Lunit

§

impl UnsafeUnpin for Lunit

§

impl UnwindSafe for Lunit

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> AnyExt for T
where T: Any + ?Sized,

Source§

fn type_id() -> TypeId

Returns the TypeId of Self. Read more
Source§

fn type_of(&self) -> TypeId

Returns the TypeId of self. Read more
Source§

fn type_name(&self) -> &'static str

Returns the type name of self. Read more
Source§

fn type_is<T: 'static>(&self) -> bool

Returns true if Self is of type T. Read more
Source§

fn type_hash(&self) -> u64

Returns a deterministic hash of the TypeId of Self.
Source§

fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64

Returns a deterministic hash of the TypeId of Self using a custom hasher.
Source§

fn as_any_ref(&self) -> &dyn Any
where Self: Sized,

Upcasts &self as &dyn Any. Read more
Source§

fn as_any_mut(&mut self) -> &mut dyn Any
where Self: Sized,

Upcasts &mut self as &mut dyn Any. Read more
Source§

fn as_any_box(self: Box<Self>) -> Box<dyn Any>
where Self: Sized,

Available on crate feature alloc only.
Upcasts Box<self> as Box<dyn Any>. Read more
Source§

fn downcast_ref<T: 'static>(&self) -> Option<&T>

Available on crate feature unsafe_layout and non-crate feature safe_code only.
Returns some shared reference to the inner value if it is of type T. Read more
Source§

fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T>

Available on crate feature unsafe_layout and non-crate feature safe_code only.
Returns some exclusive reference to the inner value if it is of type T. 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> ByteSized for T

Source§

const BYTE_ALIGN: usize = _

The alignment of this type in bytes.
Source§

const BYTE_SIZE: usize = _

The size of this type in bytes.
Source§

fn byte_align(&self) -> usize

Returns the alignment of this type in bytes.
Source§

fn byte_size(&self) -> usize

Returns the size of this type in bytes. Read more
Source§

fn ptr_size_ratio(&self) -> [usize; 2]

Returns the size ratio between Ptr::BYTES and BYTE_SIZE. 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
Source§

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Hook for T

Source§

fn hook<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Hooks a mutation step into the value and returns it. Read more
Source§

fn tap<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Taps into the value for observation and returns it unchanged. Read more
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> MemExt for T
where T: ?Sized,

Source§

const NEEDS_DROP: bool = _

Know whether dropping values of this type matters, in compile-time.
Source§

fn mem_align_of<T>() -> usize

Returns the minimum alignment of the type in bytes. Read more
Source§

fn mem_align_of_val(&self) -> usize

Returns the alignment of the pointed-to value in bytes. Read more
Source§

fn mem_size_of<T>() -> usize

Returns the size of a type in bytes. Read more
Source§

fn mem_size_of_val(&self) -> usize

Returns the size of the pointed-to value in bytes. Read more
Source§

fn mem_copy(&self) -> Self
where Self: Copy,

Bitwise-copies a value. Read more
Source§

fn mem_needs_drop(&self) -> bool

Returns true if dropping values of this type matters. Read more
Source§

fn mem_drop(self)
where Self: Sized,

Drops self by running its destructor. Read more
Source§

fn mem_forget(self)
where Self: Sized,

Forgets about self without running its destructor. Read more
Source§

fn mem_replace(&mut self, other: Self) -> Self
where Self: Sized,

Replaces self with other, returning the previous value of self. Read more
Source§

fn mem_take(&mut self) -> Self
where Self: Default,

Replaces self with its default value, returning the previous value of self. Read more
Source§

fn mem_swap(&mut self, other: &mut Self)
where Self: Sized,

Swaps the value of self and other without deinitializing either one. Read more
Source§

unsafe fn mem_zeroed<T>() -> T

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Source§

unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst

Available on crate feature unsafe_layout only.
Returns the value of type T represented by the all-zero byte-pattern. Read more
Source§

fn mem_as_bytes(&self) -> &[u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &[u8]. Read more
Source§

fn mem_as_bytes_mut(&mut self) -> &mut [u8]
where Self: Sync + Unpin,

Available on crate feature unsafe_slice only.
View a Sync + Unpin self as &mut [u8]. Read more
Source§

impl<T, R> Morph<R> for T
where T: ?Sized,

Source§

fn morph<F>(self, f: F) -> R
where F: FnOnce(Self) -> R, Self: Sized,

Morphs the value into a new one and returns it. Read more
Source§

fn morph_ref<F>(&self, f: F) -> R
where F: FnOnce(&Self) -> R,

Morphs the value by shared reference and returns the result. Read more
Source§

fn morph_mut<F>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Morphs the value by exclusive reference and returns the result. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.