#[non_exhaustive]pub struct CommonProps {
pub style: Style,
pub border_unfocused_style: Style,
pub border: Option<Borders>,
pub title: Option<Title>,
pub display: bool,
pub focused: bool,
pub always_active: bool,
}Expand description
Prop Store for very common props.
This structure helps to have a common way to handle the “very common” properties, reducing boilerplate and potential mis-matches.
Additionally, using this over Props, saves on indirection and heap-size.
On usage (usually on view), it also saves on unwraps or “defaulting”.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.style: StyleThe main and common style for a given widget. This is mostly used unless overwritten by more specific styles.
border_unfocused_style: StyleSet a different style for the border when the current component is unfocused. This will effectively be merged with style.
border: Option<Borders>A Border to apply, if set.
title: Option<Title>The title for the Border.
display: boolDetermines if the current component should be drawn at all.
focused: boolDetermines if the current component is focused or not.
always_active: boolDetermines if the current component should always use the “active” style, regardless if it is focused or not.
Implementations§
Source§impl CommonProps
impl CommonProps
Sourcepub fn set(&mut self, attr: Attribute, value: AttrValue) -> Option<AttrValue>
pub fn set(&mut self, attr: Attribute, value: AttrValue) -> Option<AttrValue>
Try to set a given Attribute. Returns Some if the value is unhandled. None if handled.
Sourcepub fn get<'a>(&'a self, attr: Attribute) -> Option<AttrValueRef<'a>>
pub fn get<'a>(&'a self, attr: Attribute) -> Option<AttrValueRef<'a>>
Try to get a given Attribute.
Sourcepub fn get_for_query<'a>(&'a self, attr: Attribute) -> Option<QueryResult<'a>>
pub fn get_for_query<'a>(&'a self, attr: Attribute) -> Option<QueryResult<'a>>
Try to get a given Attribute as a type compatible with Component::query.
Trait Implementations§
Source§impl Clone for CommonProps
impl Clone for CommonProps
Source§fn clone(&self) -> CommonProps
fn clone(&self) -> CommonProps
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommonProps
impl Debug for CommonProps
Source§impl Default for CommonProps
impl Default for CommonProps
Source§impl PartialEq for CommonProps
impl PartialEq for CommonProps
impl Eq for CommonProps
impl StructuralPartialEq for CommonProps
Auto Trait Implementations§
impl Freeze for CommonProps
impl RefUnwindSafe for CommonProps
impl Send for CommonProps
impl Sync for CommonProps
impl Unpin for CommonProps
impl UnsafeUnpin for CommonProps
impl UnwindSafe for CommonProps
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PropBound for T
impl<T> PropBound for T
Source§fn to_any_prop(self) -> Box<dyn PropBound>
fn to_any_prop(self) -> Box<dyn PropBound>
PropBound value to a AnyPropBox value.