#[non_exhaustive]pub struct CommonHighlight {
pub style: Style,
pub style_unfocused: Style,
pub symbol: LineStatic,
}Expand description
Prop Store for very common highlight props.
This structure helps to have a common way to handle the “very common” highlight 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 style to patch CommonProps::style with for the currently active element.
style_unfocused: StyleA Style to patch on-top of style when unfocused.
symbol: LineStaticThe symbol to use to indicate the currently selected element.
Implementations§
Source§impl CommonHighlight
impl CommonHighlight
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.
Sourcepub fn get_symbol(&self) -> Option<Line<'_>>
pub fn get_symbol(&self) -> Option<Line<'_>>
Get the set highlight symbol as its own Line instance, but referencing the existing data.
Sourcepub fn get_style_focus(&self, normal_style: Style, focus: bool) -> Style
pub fn get_style_focus(&self, normal_style: Style, focus: bool) -> Style
Get the patched highlight style with focused or unfocused style.
Trait Implementations§
Source§impl Clone for CommonHighlight
impl Clone for CommonHighlight
Source§fn clone(&self) -> CommonHighlight
fn clone(&self) -> CommonHighlight
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommonHighlight
impl Debug for CommonHighlight
Source§impl Default for CommonHighlight
impl Default for CommonHighlight
Source§impl PartialEq for CommonHighlight
impl PartialEq for CommonHighlight
impl Eq for CommonHighlight
impl StructuralPartialEq for CommonHighlight
Auto Trait Implementations§
impl Freeze for CommonHighlight
impl RefUnwindSafe for CommonHighlight
impl Send for CommonHighlight
impl Sync for CommonHighlight
impl Unpin for CommonHighlight
impl UnsafeUnpin for CommonHighlight
impl UnwindSafe for CommonHighlight
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.