pub enum Element<L> {
Shape(Shape<L>),
Text(Text<L>),
}
Expand description
A primitive layout element.
Variants§
Implementations§
Source§impl<L> Element<L>
impl<L> Element<L>
Sourcepub fn unwrap_shape(self) -> Shape<L>
pub fn unwrap_shape(self) -> Shape<L>
Returns the value contained in this variant.
§Panics
Panics if the enum value is not of the expected variant.
Sourcepub fn get_shape(&self) -> Option<&Shape<L>>
pub fn get_shape(&self) -> Option<&Shape<L>>
Returns a reference to the value contained in this variant.
Returns None
if the enum value is not of the expected variant.
Sourcepub fn into_shape(self) -> Option<Shape<L>>
pub fn into_shape(self) -> Option<Shape<L>>
Returns the value contained in this variant.
Returns None
if the enum value is not of the expected variant.
Sourcepub fn unwrap_text(self) -> Text<L>
pub fn unwrap_text(self) -> Text<L>
Returns the value contained in this variant.
§Panics
Panics if the enum value is not of the expected variant.
Sourcepub fn get_text(&self) -> Option<&Text<L>>
pub fn get_text(&self) -> Option<&Text<L>>
Returns a reference to the value contained in this variant.
Returns None
if the enum value is not of the expected variant.
Sourcepub fn into_text(self) -> Option<Text<L>>
pub fn into_text(self) -> Option<Text<L>>
Returns the value contained in this variant.
Returns None
if the enum value is not of the expected variant.
Sourcepub fn as_ref(&self) -> ElementRef<&Shape<L>, &Text<L>>
pub fn as_ref(&self) -> ElementRef<&Shape<L>, &Text<L>>
Converts types to references.
For example, transforms a variant field with type T
to &T
.
Sourcepub fn as_mut(&mut self) -> ElementRef<&mut Shape<L>, &mut Text<L>>
pub fn as_mut(&mut self) -> ElementRef<&mut Shape<L>, &mut Text<L>>
Converts types to mutable references.
For example, transforms a variant field with type T
to &mut T
.
Trait Implementations§
Source§impl<'de, L> Deserialize<'de> for Element<L>where
L: Deserialize<'de>,
impl<'de, L> Deserialize<'de> for Element<L>where
L: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<L: Eq> Eq for Element<L>
impl<L> StructuralPartialEq for Element<L>
Auto Trait Implementations§
impl<L> Freeze for Element<L>where
L: Freeze,
impl<L> RefUnwindSafe for Element<L>where
L: RefUnwindSafe,
impl<L> Send for Element<L>where
L: Send,
impl<L> Sync for Element<L>where
L: Sync,
impl<L> Unpin for Element<L>where
L: Unpin,
impl<L> UnwindSafe for Element<L>where
L: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.